particula.particles.representation¶
representation
¶
Legacy particle representation facade.
Provides a deprecated facade over :class:ParticleData while preserving the
legacy API for distribution strategies, activities, and surfaces.
ParticleRepresentation
¶
ParticleRepresentation(strategy: DistributionStrategy, activity: ActivityStrategy, surface: SurfaceStrategy, distribution: NDArray[float64] | float, density: NDArray[float64] | float, concentration: NDArray[float64] | float, charge: NDArray[float64] | float | None, volume: float = 1)
Everything needed to represent a particle or a collection of particles.
Attributes:
-
strategy–Distribution strategy for particle representation.
-
activity–Activity strategy for partial pressure calculations.
-
surface–Surface strategy for surface tension/Kelvin effects.
-
distribution(NDArray[float64]) –Distribution data for the particles.
-
density(NDArray[float64]) –Density array for the particles.
-
concentration(NDArray[float64]) –Concentration data for the particles.
-
charge(NDArray[float64] | None) –Charge per particle.
-
volume(float) –Simulation volume for the representation.
Initialize the ParticleRepresentation.
Sets up the particle representation with required strategies and properties including distribution, density, concentration, charge, and volume for particle calculations. This legacy facade emits a deprecation warning and stores state in a ParticleData container.
Source code in particula/particles/representation.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
charge
property
writable
¶
charge: NDArray[float64] | None
Return charge array or None when charge is disabled.
concentration
property
writable
¶
concentration: NDArray[float64]
Return the concentration array for box 0.
distribution
property
writable
¶
distribution: NDArray[float64]
Return the cached distribution array.
__str__
¶
__str__() -> str
Returns a string representation of the particle representation.
Returns:
-
str–- A string representation of the particle representation.
Example
str_rep = str(particle_representation)
print(str_rep)
Source code in particula/particles/representation.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
add_concentration
¶
add_concentration(added_concentration: NDArray[float64], added_distribution: Optional[NDArray[float64]] = None, *, added_charge: Optional[NDArray[float64]] = None) -> None
Add concentration to the particle distribution.
Parameters:
-
- added_concentration–The concentration to be added per bin (1/m^3).
-
- added_distribution–Optional distribution array to merge into the existing distribution. If None, the current distribution is reused.
-
- added_charge–Optional charge array for newly added particles. Defaults to zeros when charge is tracked but no values are provided. Ignored when charge is not tracked.
Example
particle_representation.add_concentration(added_concentration)
Source code in particula/particles/representation.py
760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | |
add_mass
¶
add_mass(added_mass: NDArray[float64]) -> None
Add mass to the particle distribution and update parameters.
Parameters:
-
- added_mass–The mass to be added per distribution bin, in kg.
Example
particle_representation.add_mass(added_mass)
Source code in particula/particles/representation.py
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | |
collide_pairs
¶
collide_pairs(indices: NDArray[int64]) -> None
Collide pairs of particles, used for ParticleResolved Strategies.
Performs coagulation between particle pairs by delegating to the distribution strategy's collide_pairs method. The smaller particle (first index in each pair) is merged into the larger particle (second index). Mass, concentration, and charge are all updated accordingly.
Charge conservation is handled automatically: if the particles have non-zero charges, they are summed during collisions. This enables physically accurate charge conservation in particle-resolved coagulation simulations.
Parameters:
-
- indices–Array of particle pair indices to collide, shape (K, 2) where each row is [small_index, large_index].
Example
particle_representation.collide_pairs(indices)
Source code in particula/particles/representation.py
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 | |
from_data
classmethod
¶
from_data(data: ParticleData, *, strategy: DistributionStrategy, activity: ActivityStrategy, surface: SurfaceStrategy, distribution: NDArray[float64], charge: NDArray[float64] | None = None) -> ParticleRepresentation
Create a facade without emitting a deprecation warning.
Parameters:
-
data(ParticleData) –ParticleData instance to wrap.
-
strategy(DistributionStrategy) –Distribution strategy for this facade.
-
activity(ActivityStrategy) –Activity strategy for this facade.
-
surface(SurfaceStrategy) –Surface strategy for this facade.
-
distribution(NDArray[float64]) –Cached distribution values for the facade.
-
charge(NDArray[float64] | None, default:None) –Optional charge array to preserve legacy API.
Returns:
-
ParticleRepresentation–ParticleRepresentation instance wrapping
data.
Source code in particula/particles/representation.py
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 | |
get_activity
¶
get_activity(clone: bool = False) -> ActivityStrategy
Return the activity strategy used for partial pressure calculations.
Parameters:
-
- clone–If True, then return a deepcopy of the activity strategy.
Returns:
-
ActivityStrategy–- The activity strategy used for partial pressure calculations.
Example
activity = particle_representation.get_activity()
Source code in particula/particles/representation.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | |
get_activity_name
¶
get_activity_name() -> str
Return the name of the activity strategy used for partial pressure calculations.
Returns:
-
str–- The name of the activity strategy used for partial pressure calculations.
Example
activity_name = particle_representation.get_activity_name()
print(activity_name)
Source code in particula/particles/representation.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |
get_charge
¶
get_charge(clone: bool = False) -> NDArray[np.float64] | None
Return the charge per particle.
Parameters:
-
- clone–If True, then return a copy of the charge array.
Returns:
-
NDArray[float64] | None–- The charge of the particles (dimensionless).
Example
charge = particle_representation.get_charge()
Source code in particula/particles/representation.py
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | |
get_concentration
¶
get_concentration(clone: bool = False) -> NDArray[np.float64]
Return the volume concentration of the particles.
For ParticleResolved Strategies, this is the number of particles per self.volume. Otherwise, it's per 1/m^3.
Parameters:
-
- clone–If True, then return a copy of the concentration array.
Returns:
-
NDArray[float64]–- The concentration of the particles in 1/m^3.
Example
concentration = particle_representation.get_concentration()
Source code in particula/particles/representation.py
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | |
get_density
¶
get_density(clone: bool = False) -> NDArray[np.float64]
Return the density of the particles.
Parameters:
-
- clone–If True, then return a copy of the density array.
Returns:
-
NDArray[float64]–- The density of the particles.
Example
density = particle_representation.get_density()
Source code in particula/particles/representation.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | |
get_distribution
¶
get_distribution(clone: bool = False) -> NDArray[np.float64]
Return the distribution of the particles.
Parameters:
-
- clone–If True, then return a copy of the distribution array.
Returns:
-
NDArray[float64]–- The distribution of the particles.
Example
distribution = particle_representation.get_distribution()
Source code in particula/particles/representation.py
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | |
get_effective_density
¶
get_effective_density() -> NDArray[np.float64]
Return the effective density of the particles, weighted by the mass.
Returns:
-
NDArray[float64]–- The effective density of the particles.
Example
effective_density = particle_representation.get_effective_density()
Source code in particula/particles/representation.py
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
get_mass
¶
get_mass(clone: bool = False) -> NDArray[np.float64]
Return the mass of the particles as calculated by the strategy.
Parameters:
-
- clone–If True, then return a copy of the mass array.
Returns:
-
NDArray[float64]–- The mass of the particles in kg.
Example
mass = particle_representation.get_mass()
Source code in particula/particles/representation.py
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | |
get_mass_concentration
¶
get_mass_concentration(clone: bool = False) -> np.float64
Return the total mass per volume of the simulated particles.
The mass concentration is calculated from the distribution and concentration arrays.
Parameters:
-
- clone–If True, then return a copy of the mass concentration value.
Returns:
-
float64–- The mass concentration in kg/m^3.
Example
mass_concentration = (
particle_representation.get_mass_concentration()
)
print(mass_concentration)
Source code in particula/particles/representation.py
690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | |
get_mean_effective_density
¶
get_mean_effective_density() -> float
Return the mean effective density of the particles.
Returns:
-
float–- The mean effective density of the particles.
Example
mean_effective_density = (
particle_representation.get_mean_effective_density()
)
Source code in particula/particles/representation.py
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | |
get_radius
¶
get_radius(clone: bool = False) -> NDArray[np.float64]
Return the radius of the particles as calculated by the strategy.
Parameters:
-
- clone–If True, then return a copy of the radius array.
Returns:
-
NDArray[float64]–- The radius of the particles in meters.
Example
radius = particle_representation.get_radius()
Source code in particula/particles/representation.py
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | |
get_species_mass
¶
get_species_mass(clone: bool = False) -> NDArray[np.float64]
Return the masses per species in the particles.
Parameters:
-
- clone–If True, then return a copy of the computed mass array.
Returns:
-
NDArray[float64]–- The mass of the particles per species in kg.
Example
species_mass = particle_representation.get_species_mass()
Source code in particula/particles/representation.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 | |
get_strategy
¶
get_strategy(clone: bool = False) -> DistributionStrategy
Return the strategy used for particle representation.
Parameters:
-
- clone–If True, then return a deepcopy of the strategy.
Returns:
-
DistributionStrategy–- The strategy used for particle representation.
Example
strategy = particle_representation.get_strategy()
Source code in particula/particles/representation.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | |
get_strategy_name
¶
get_strategy_name() -> str
Return the name of the strategy used for particle representation.
Returns:
-
str–- The name of the strategy used for particle representation.
Example
strategy_name = particle_representation.get_strategy_name()
print(strategy_name)
Source code in particula/particles/representation.py
405 406 407 408 409 410 411 412 413 414 415 416 417 | |
get_surface
¶
get_surface(clone: bool = False) -> SurfaceStrategy
Return surface strategy for surface tension and Kelvin effect.
Parameters:
-
- clone–If True, then return a deepcopy of the surface strategy.
Returns:
-
SurfaceStrategy–- The surface strategy used for surface tension and Kelvin effect.
Example
surface = particle_representation.get_surface()
Source code in particula/particles/representation.py
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | |
get_surface_name
¶
get_surface_name() -> str
Return the name of the surface strategy used for surface tension and Kelvin effect.
Returns:
-
str–- The name of the surface strategy used for surface tension and Kelvin effect.
Example
surface_name = particle_representation.get_surface_name()
print(surface_name)
Source code in particula/particles/representation.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | |
get_total_concentration
¶
get_total_concentration(clone: bool = False) -> np.float64
Return the total concentration of the particles.
Parameters:
-
- clone–If True, then return a copy of the concentration array.
Returns:
-
float64–- The total number concentration of the particles in 1/m^3.
Example
total_concentration = (
particle_representation.get_total_concentration()
)
print(total_concentration)
Source code in particula/particles/representation.py
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | |
get_volume
¶
get_volume(clone: bool = False) -> float
Return the volume used for the particle representation.
Parameters:
-
- clone–If True, then return a copy of the volume value.
Returns:
-
float–- The volume of the particles in m^3.
Example
volume = particle_representation.get_volume()
Source code in particula/particles/representation.py
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | |