Skip to content

Commit

Permalink
fixup: set corner for temperature BC
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Feb 14, 2024
1 parent 9b68c26 commit 100050a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/thermal_deformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ int main( int argc, char* argv[] )

auto bc = createBoundaryCondition( CabanaPD::TempBCTag{}, 5000.0,
exec_space{}, *particles, domain );
bc.setCorner( low_corner[1] );

auto init_functor = KOKKOS_LAMBDA( const int pid )
{
Expand Down
6 changes: 5 additions & 1 deletion src/CabanaPD_Boundary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,16 @@ struct BoundaryCondition<BCIndexSpace, TempBCTag>
{
double _value;
BCIndexSpace _index_space;
double _low_corner = 0.0;

BoundaryCondition( const double value, BCIndexSpace bc_index_space )
: _value( value )
, _index_space( bc_index_space )
{
}

void setCorner( const double low ) { _low_corner = low; }

template <class ExecSpace, class Particles>
void update( ExecSpace exec_space, Particles particles,
RegionBoundary plane )
Expand All @@ -197,13 +200,14 @@ struct BoundaryCondition<BCIndexSpace, TempBCTag>
auto temp = particles.sliceTemperature();
auto x = particles.sliceReferencePosition();
auto value = _value;
auto low_corner = _low_corner;
auto index_space = _index_space._view;
Kokkos::RangePolicy<ExecSpace> policy( 0, index_space.size() );
Kokkos::parallel_for(
"CabanaPD::BC::apply", policy, KOKKOS_LAMBDA( const int b ) {
auto pid = index_space( b );
// This is specifically for the thermal deformation problem
temp( pid ) = value * x( pid, 1 ) * t;
temp( pid ) = value * ( x( pid, 1 ) - low_corner ) * t;
} );
}
};
Expand Down

0 comments on commit 100050a

Please sign in to comment.