Skip to content

Commit

Permalink
fix thermal problem
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve committed Dec 18, 2023
1 parent 430ce45 commit 1d12c61
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/thermal_deformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int main( int argc, char* argv[] )
particles->updateParticles( exec_space{}, init_functor );

auto cabana_pd = CabanaPD::createSolverElastic<memory_space>(
inputs, particles, force_model );
inputs, particles, force_model, bc );
cabana_pd->init_force();
cabana_pd->run();

Expand Down
10 changes: 2 additions & 8 deletions src/CabanaPD_Boundary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct BoundaryCondition<BCIndexSpace, ZeroBCTag>
}

template <class ExecSpace, class ParticleType>
void apply( ExecSpace, ParticleType )
void apply( ExecSpace, ParticleType, double )
{
}
};
Expand Down Expand Up @@ -188,8 +188,6 @@ struct BoundaryCondition<BCIndexSpace, ForceValueBCTag>
auto pid = index_space( b );
// This is specifically for the thermal deformation problem
temp( pid ) = 5000 * x( pid, 1 ) * t;
std::cout << "1: temp(" << pid << ")=" << temp( pid )
<< std::endl;
} );
}
};
Expand Down Expand Up @@ -225,8 +223,6 @@ struct BoundaryCondition<BCIndexSpace, ForceUpdateBCTag>
auto pid = index_space( b );
// This is specifically for the thermal deformation problem
temp( pid ) += 5000 * x( pid, 1 ) * t;
std::cout << "2: temp(" << pid << ")=" << temp( pid )
<< std::endl;
} );
}
};
Expand Down Expand Up @@ -263,8 +259,6 @@ struct BoundaryCondition<BCIndexSpace, ForceCrackBranchBCTag>
auto pid = index_space( b );
// This is specifically for the thermal deformation problem
temp( pid ) += 5000 * x( pid, 1 ) * t;
std::cout << "3: temp(" << pid << ")=" << temp( pid )
<< std::endl;
} );
}
};
Expand All @@ -274,7 +268,7 @@ template <class BoundaryType, class BCTag, class ExecSpace, class Particles>
auto createBoundaryCondition( BCTag, ExecSpace exec_space, Particles particles,
std::vector<BoundaryType> planes,
const double value,
const double initial_guess = 0.5 )
const double initial_guess = 1.1 )
{
using memory_space = typename Particles::memory_space;
using bc_index_type = BoundaryIndexSpace<memory_space, BoundaryType>;
Expand Down
6 changes: 4 additions & 2 deletions src/CabanaPD_Particles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,15 @@ class Particles<MemorySpace, PMB, Dimension>
Cabana::Experimental::HDF5ParticleOutput::writeTimeStep(
h5_config, "particles", MPI_COMM_WORLD, output_step, output_time,
n_local, getPosition( use_reference ), sliceStrainEnergy(),
sliceForce(), sliceDisplacement(), sliceVelocity(), sliceDamage() );
sliceForce(), sliceDisplacement(), sliceVelocity(), sliceDamage(),
sliceTemperature() );
#else
#ifdef Cabana_ENABLE_SILO
Cajita::Experimental::SiloParticleOutput::writePartialRangeTimeStep(
"particles", local_grid->globalGrid(), output_step, output_time, 0,
n_local, getPosition( use_reference ), sliceStrainEnergy(),
sliceForce(), sliceDisplacement(), sliceVelocity(), sliceDamage() );
sliceForce(), sliceDisplacement(), sliceVelocity(), sliceDamage(),
sliceTemperature() );
#else
log( std::cout, "No particle output enabled." );
#endif
Expand Down
5 changes: 3 additions & 2 deletions src/CabanaPD_Solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class SolverElastic
computeEnergy( *force, *particles, *neighbors, neigh_iter_tag() );

// Add boundary condition.
boundary_condition.apply( exec_space(), *particles );
boundary_condition.apply( exec_space(), *particles, 0.0 );

particles->output( 0, 0.0, output_reference );
init_time += init_timer.seconds();
Expand Down Expand Up @@ -231,7 +231,8 @@ class SolverElastic
force_time += force_timer.seconds();

// Add boundary condition.
boundary_condition.apply( exec_space(), *particles );
boundary_condition.apply( exec_space(), *particles,
step * inputs->timestep );

// Integrate - velocity Verlet second half.
integrate_timer.reset();
Expand Down

0 comments on commit 1d12c61

Please sign in to comment.