Dear Prof. Wolfganag,
Thank you for the suggestion. I ran debugger with the ".prm" file and was successful to backtrace the error and resolved it. After this, using the step-19 particles tutorial refered by you, so far I am also successful in creating and exporting out the particles in ".vtu" file to visualize their ids and location (which is quadrature points location in my case).
As a next step, After creating particle on quadrature point, I am now trying to assign it the quadrature point value which is "SymmetricTensor<2, dim>" in my case. I am using following simplified function similar to the one in particles tutorial file of step-19:
template <int dim>
void Problem<dim>::create_particles()
{
next_unused_particle_id = 1;
FEValues<dim> fe_values (fe, quadrature_formula,
update_values | update_gradients |
update_quadrature_points);
for (const auto &cell : dof_handler.active_cell_iterators())
{
PointHistory<dim> *local_quadrature_points_history
= reinterpret_cast<PointHistory<dim> *>(cell->user_pointer());
Assert (local_quadrature_points_history >=
&quadrature_point_history.front(),
ExcInternalError());
Assert (local_quadrature_points_history <
&quadrature_point_history.back(),
ExcInternalError());
fe_values.reinit(cell);
for (const unsigned int q_point :
fe_values.quadrature_point_indices())
{
const Point<dim> location =
fe_values.quadrature_point(q_point);
Particles::Particle<dim> new_particle;
new_particle.set_location(location);
new_particle.set_reference_location(
mapping.transform_real_to_unit_cell(cell, location));
new_particle.set_id(next_unused_particle_id);
SymmetricTensor<2, dim> total_strain = local_quadrature_points_history[q_point].old_strain;
new_particle.set_properties(make_array_view(total_strain));
particle_handler.insert_particle(new_particle, cell);
++next_unused_particle_id;
}
}
particle_handler.update_cached_numbers();
}
But it gives the following error on running:
An error occurred in line <298> of file </home/muhammad/software/dealii-9.2.0/source/particles/particle.cc> in function
void dealii::Particles::Particle<dim, spacedim>::set_properties(const dealii::ArrayView<const double>&) [with int dim = 3; int spacedim = 3]
The violated condition was:
property_pool != nullptr
Additional information:
This exception -- which is used in many places in the library -- usually indicates that some condition which the author of the code thought must be satisfied at a certain point in an algorithm, is not fulfilled. An example would be that the first part of an algorithm sorts elements of an array in ascending order, and a second part of the algorithm later encounters an element that is not larger than the previous one.
There is usually not very much you can do if you encounter such an exception since it indicates an error in deal.II, not in your own program. Try to come up with the smallest possible program that still demonstrates the error and contact the deal.II mailing lists with it to obtain help.
I tried to fix it by initializing and setting the property pool to the new_particle in my current function :
Particles::PropertyPool propertypool(6); // six entries present in the symmetric tensor of second order
new_particle.set_property_pool(propertypool);
But still it stops with the following error:
An error occurred in line <531> of file </home/muhammad/software/dealii-9.2.0/include/deal.II/base/array_view.h> in function
dealii::ArrayView<ElementType, MemorySpaceType>::value_type& dealii::ArrayView<ElementType, MemorySpaceType>::operator[](std::size_t) const [with ElementType = double; MemorySpaceType = dealii::MemorySpace::Host; dealii::ArrayView<ElementType, MemorySpaceType>::value_type = double; std::size_t = long unsigned int]
The violated condition was:
static_cast<typename ::dealii::internal::argument_type<void( typename std::common_type<decltype(i), decltype(n_elements)>::type)>:: type>(i) < static_cast<typename ::dealii::internal::argument_type<void( typename std::common_type<decltype(i), decltype(n_elements)>::type)>:: type>(n_elements)
Additional information:
Index 3 is not in the half-open range [0,3).
I explored the mailing list and found someone from the community already had similar problem of assigning the properties to the particles where it was suggested to use following way of assigning the properties:
for( auto iter=particleHandler.begin(); iter!=particleHandler.end();
++iter, ++part )
iter->set_properties
(make_array_view(interpolatedParticleQuantities.begin()+
part*ncomponents,
interpolatedParticleQuantities.begin()+
part*ncomponents + ncomponents));
If I have related it correctly to my case, I also then tried the similar way e.g.
new_particle.set_properties(make_array_view(total_strain.begin_raw(),
total_strain.end_raw()));
instead of new_particle.set_properties(make_array_view(total_strain));
It still stops with the same (2nd) error as mentioned above. Is there another way of doing it or am I not using the correct approach as per my limited knowledge so far? Sorry for the lengthy thread, I wanted to clear out the approaches which I tried so far as much as possible.
Thank you very much for your ongoing and productive support.
Regards,
Muhammad