peclet.voro 1.0.0
Device-native moving-particle Voronoi dynamics
Loading...
Searching...
No Matches
interface.hpp
Go to the documentation of this file.
1
13#ifndef PECLET_VORO_PHYSICS_INTERFACE_HPP
14#define PECLET_VORO_PHYSICS_INTERFACE_HPP
15
16#include <Kokkos_Core.hpp>
17
18#include "peclet/core/common/view.hpp"
20
21namespace peclet::voro {
22namespace physics {
23
25template <class Real>
27 const Kokkos::View<int*, peclet::core::MemSpace>& types,
28 const Kokkos::View<Real*, peclet::core::MemSpace>& tension, int nTypes) {
29 using Exec = peclet::core::ExecSpace;
30 const int N = view.numCells();
31 Real e = 0;
32 Kokkos::parallel_reduce(
33 "intf.energy", Kokkos::RangePolicy<Exec>(0, N),
34 KOKKOS_LAMBDA(const int i, Real& acc) {
35 const int ti = types(i);
36 if (ti == 0)
37 return;
38 for (int f = view.facetBegin(i); f < view.facetEnd(i); ++f) {
39 const int j = view.facetNbr(f);
40 if (j < 0 || j >= N)
41 continue;
42 const int tj = types(j);
43 if (tj < ti) {
44 Real ax = view.area(f, 0), ay = view.area(f, 1), az = view.area(f, 2);
45 acc += tension(ti * nTypes + tj) * Kokkos::sqrt(ax * ax + ay * ay + az * az);
46 }
47 }
48 },
49 e);
50 return e;
51}
52
53} // namespace physics
54} // namespace peclet::voro
55
56#endif // PECLET_VORO_PHYSICS_INTERFACE_HPP
Real interfaceEnergy(const TessellationView< Real > &view, const Kokkos::View< int *, peclet::core::MemSpace > &types, const Kokkos::View< Real *, peclet::core::MemSpace > &tension, int nTypes)
Total interfacial energy Σ γ(t_i,t_j)·area over phase-boundary facets.
Definition interface.hpp:26
Definition convex_cell.hpp:40
Definition tessellation_view.hpp:111
KOKKOS_INLINE_FUNCTION Real area(int f, int c) const
Definition tessellation_view.hpp:144
KOKKOS_INLINE_FUNCTION int facetEnd(int i) const
Definition tessellation_view.hpp:140
KOKKOS_INLINE_FUNCTION gid_t facetNbr(int f) const
Definition tessellation_view.hpp:143
KOKKOS_INLINE_FUNCTION int facetBegin(int i) const
Definition tessellation_view.hpp:139
KOKKOS_INLINE_FUNCTION int numCells() const
Definition tessellation_view.hpp:131
Published, read-only device data layer for the tessellation (migration §2.1, §3).