Skip to content

Commit

Permalink
Add temperature field
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Oct 20, 2023
1 parent 96251aa commit 73eee6a
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/CabanaPD_Particles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ class Particles<MemorySpace, PMB, Dimension>
using scalar_type = Cabana::MemberTypes<double>;
// no-fail.
using int_type = Cabana::MemberTypes<int>;
// type, W, v, rho, damage.
// v, W, rho, damage, temperature, type.
using other_types =
Cabana::MemberTypes<int, double, double[dim], double, double>;
Cabana::MemberTypes<double[dim], double, double, double, double, int>;
// Potentially needed later: body force (b), ID.

// FIXME: add vector length.
Expand Down Expand Up @@ -220,6 +220,7 @@ class Particles<MemorySpace, PMB, Dimension>
auto y = sliceCurrentPosition();
auto vol = sliceVolume();
auto nofail = sliceNoFail();
auto temp = sliceNoFail();

auto created = Kokkos::View<bool*, memory_space>(
Kokkos::ViewAllocateWithoutInitializing( "particle_created" ),
Expand Down Expand Up @@ -260,6 +261,7 @@ class Particles<MemorySpace, PMB, Dimension>
type( pid ) = 0;
nofail( pid ) = 0;
rho( pid ) = 1.0;
temp( pid ) = 0.0;

// Get the volume of the cell.
int empty[3];
Expand Down Expand Up @@ -337,8 +339,8 @@ class Particles<MemorySpace, PMB, Dimension>
{
return Cabana::slice<0>( _aosoa_vol, "volume" );
}
auto sliceType() { return Cabana::slice<0>( _aosoa_other, "type" ); }
auto sliceType() const { return Cabana::slice<0>( _aosoa_other, "type" ); }
auto sliceType() { return Cabana::slice<5>( _aosoa_other, "type" ); }
auto sliceType() const { return Cabana::slice<5>( _aosoa_other, "type" ); }
auto sliceStrainEnergy()
{
return Cabana::slice<1>( _aosoa_other, "strain_energy" );
Expand All @@ -349,21 +351,29 @@ class Particles<MemorySpace, PMB, Dimension>
}
auto sliceVelocity()
{
return Cabana::slice<2>( _aosoa_other, "velocities" );
return Cabana::slice<0>( _aosoa_other, "velocities" );
}
auto sliceVelocity() const
{
return Cabana::slice<2>( _aosoa_other, "velocities" );
return Cabana::slice<0>( _aosoa_other, "velocities" );
}
auto sliceDensity() { return Cabana::slice<3>( _aosoa_other, "density" ); }
auto sliceDensity() { return Cabana::slice<2>( _aosoa_other, "density" ); }
auto sliceDensity() const
{
return Cabana::slice<3>( _aosoa_other, "density" );
return Cabana::slice<2>( _aosoa_other, "density" );
}
auto sliceDamage() { return Cabana::slice<4>( _aosoa_other, "damage" ); }
auto sliceDamage() { return Cabana::slice<3>( _aosoa_other, "damage" ); }
auto sliceDamage() const
{
return Cabana::slice<4>( _aosoa_other, "damage" );
return Cabana::slice<3>( _aosoa_other, "damage" );
}
auto sliceTemperature()
{
return Cabana::slice<4>( _aosoa_other, "temperature" );
}
auto sliceTemperature() const
{
return Cabana::slice<4>( _aosoa_other, "temperature" );
}
auto sliceNoFail()
{
Expand Down

0 comments on commit 73eee6a

Please sign in to comment.