Add ADR integration#284
Conversation
| stiffness[i] = ( -forces( index, i ) + | ||
| _forces_last_step( index, i ) ) / | ||
| mass[i] / _delta_t / | ||
| _velocities_last_step( index, i ); |
There was a problem hiding this comment.
This is where it differs from the paper
d5e5fef to
48a5aae
Compare
| #include <fstream> | ||
| #include <iostream> | ||
|
|
||
| #include "mpi.h" |
There was a problem hiding this comment.
hmm currently this does not support mpi ... maybe I should remove it
| ParticleType const& particles ) | ||
| { | ||
| auto forces = particles.sliceForce(); | ||
| _integrator.initialSubStep( exec_space, forces ); |
There was a problem hiding this comment.
Hmm...right now the integrator cycles over all particles ... that is probably false and should be corrected somehow ... I guess the best would be to create proxy objects for the slices
| integrator.middleSubStep( exec_space, particles, args... ); | ||
|
|
||
| // Add non-force boundary condition. | ||
| if ( !boundary_condition.forceUpdate() ) | ||
| boundary_condition.apply( exec_space, particles, time ); | ||
|
|
||
| integrator.finalSubStep( exec_space, particles, args... ); |
There was a problem hiding this comment.
This is the reason why we need a middle step. We calculate the velocity in the middle step but need to overwrite it with the bc if the bc sets a velocity. After that is applied we can go and integrate the displacement
|
"Think about how to guess c for non PMB materials". This is a big question for the application. People cannot calibrate the c for each material, since the material behavior is different. I am trying to define a bond-based JC strain rate-dependent model, and i define the equivalent plastic strain as the weighted root-mean-square norm of norm of bond plastic stretches in PMB model. The theoretical consistency needs further study. Maybe use a reasonable mapping method of bond deformation to the material point strain, it will provide a easy way for defining different classical material in the future. |
I guess we would be fine with guessing a minimal value for Maybe guessing |
bcba56d to
a11ecdf
Compare
JBludau
left a comment
There was a problem hiding this comment.
The recent addition uses the specific c for every material instead of a user given c for multimaterial cases.
| #include <CabanaPD_Integrate.hpp> | ||
| #include <CabanaPD_Particles.hpp> | ||
| #include <CabanaPD_config.hpp> | ||
| #include <CabanaPD.hpp> |
There was a problem hiding this comment.
Not something I like, but the multimaterial and particle together need almost everything
| std::enable_if_t<current == ParameterPackType::size - 1, int> = 0> | ||
| KOKKOS_INLINE_FUNCTION auto recursion_functor_for_index_in_pack_with_args( | ||
| FunctorType const& functor, std::size_t index, | ||
| ParameterPackType& parameterPack, ARGS... args ) | ||
| { | ||
| if ( index == current ) | ||
| { | ||
| return functor( Cabana::get<current>( parameterPack ), args... ); | ||
| } | ||
| else | ||
| { | ||
| return recursion_functor_for_index_in_pack_with_args<current + 1>( | ||
| functor, index, parameterPack, args... ); | ||
| Kokkos::abort( "Requested index not contained in ParameterPack" ); | ||
| return functor( Cabana::get<current>( parameterPack ), args... ); |
There was a problem hiding this comment.
This is basically just a reversal of order of the two functions in the file. The old order was spoofing the compiler to not see the second SFINAE version.
| for ( unsigned i = 0; i < IndexingType::NumBaseModels; ++i ) | ||
| { | ||
| _c[i] = CabanaPD::Impl::run_functor_for_index_in_pack_with_args( | ||
| GetCFunctor{}, i, _models.models ); | ||
| } |
There was a problem hiding this comment.
This is the critical part where the multimaterial differs from single material. We need to get the correct stiffness for a specific material and store it. But we only get the basic set of materials, not the averaged ones. The reason for that is in the comment line 406
| double KOKKOS_FUNCTION operator()( IndexType index, int ) const | ||
| { | ||
| auto materialIndex = | ||
| _indexing( _particleType( index ), _particleType( index ) ); | ||
| return _safety_factor * | ||
| ( _delta_t * _delta_t * Kokkos::numbers::pi * _horizon * | ||
| _horizon * _horizon * _c[materialIndex] ) / | ||
| ( 3.0 * _delta_x ); | ||
| } |
There was a problem hiding this comment.
During the integration, we iterate over the particles and only have one particle index. That means we can only have one c that we use for the fictitious mass even though the particle we are integrating might only use this c in some of its bonds.
But currently I don't see a way for us to get a better estimate for c with reasonable effort ... we could average c over the neighborhood and store it for every particle, but that would be a lot of new algorithmic lift and data. And it would need to be recomputed every step as bonds can break.
though we are using adr
This is based upon the formulation in https://www.sciencedirect.com/science/article/pii/S0020768317304833 but without the rotational stiffness.
One important difference is: in (75) we use (L_u(t-1)/Delta_ii-L_u(t)/Delta_ii). This corresponds to a -1*(75). Otherwise we get negative damping coefficients due to the approximated stiffness term being negative (the force difference points opposite to the velocity).
The implementation tries to be independent of CabanaPD's particle interface. This allows for easier testing (testcase is just a single mass) and potential reuse.
Add interface inNot sure if that is a good idea ... we need to discuss this probably. In general the interface is still a bit ugly. The points are marked withSolverclassTODOin commentsADRIntegratorcfor nonPMBmaterialsRelated to issue #207