Re: [deal.II] Clearing a particle properties without getting properties for each particle
Maybe it is callgrind that is playing tricks on me. Here is the code : for (auto particle = particle_handler.begin(); particle != particle_handler.end(); ++particle) { // Getting properties of particle as local variable auto particle_properties = particle->get_properties(); // Reinitializing forces and momentums of particles in the system particle_properties[DEM::PropertiesIndex::force_x] = 0; particle_properties[DEM::PropertiesIndex::force_y] = 0; particle_properties[DEM::PropertiesIndex::M_x] = 0; particle_properties[DEM::PropertiesIndex::M_y] = 0; if (dim == 3) { particle_properties[DEM::PropertiesIndex::force_z] = 0; particle_properties[DEM::PropertiesIndex::M_z] = 0; } } With dim a template parameter of the class. The index for the particle properties are part of an enum: enum PropertiesIndex : int { type = 0, dp = 1, rho = 2, v_x = 3, v_y = 4, v_z = 5, acc_x = 6, acc_y = 7, acc_z = 8, force_x = 9, force_y = 10, force_z = 11, omega_x = 12, omega_y = 13, omega_z = 14, mass = 15, mom_inertia = 16, M_x = 17, M_y = 18, M_z = 19, displacement_x = 20, displacement_y = 21, displacement_z = 22, n_properties = 23, }; I was not sure on what would be the best data structure to identify the data in the particle properties, hence this type of enum (which I know is maybe not ideal but...) Do you have any suggestions? Could it just be the cost of iterating through the map that callgrinds wrongly affects to the zeroing of the variables? On Saturday, October 17, 2020 at 2:30:40 p.m. UTC-4 Wolfgang Bangerth wrote: > > > I was wondering if there was a more optimal way to do this? I have > profiled it > > with callgrind and it seems that getting the properties array view from > the > > particle can be really expensive. > > Since what we want to achieve is just to set one of these properties to > zero, > > I was wondering if there was not a possible optimisation? For example, > could > > we just get the array view once and assuming its continuity, set all of > the > > same property to zero? > > That seems strange to me. The get_properties() function is in essence a > one-liner with a few indirections. Can you show the code in which you set > properties to zero? > > Best > W. > > -- > > Wolfgang Bangerth email: bang...@colostate.edu > www: http://www.math.colostate.edu/~bangerth/ > > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/674e23f3-3a66-48bb-8971-c68280eeb0d5n%40googlegroups.com.
Re: [deal.II] FullMatrix to SparseMatrix
Yes it appears to be the system_matrix_inverse because I can print out the residual and it is indeed not empty. On Saturday, October 17, 2020 at 2:32:02 PM UTC-4 Wolfgang Bangerth wrote: > On 10/16/20 10:35 AM, Nikki Holtzer wrote: > > > > The error I'm receiving is: > > > > An error occurred in line <179> of file > > > > > > in function > > > > void dealii::FullMatrix::vmult(dealii::Vector&, > const > > dealii::Vector&, bool) const [with number2 = double; number > = double] > > > > The violated condition was: > > > > !this->empty() > > > > Additional information: > > > > (none) > > The error message states that you are trying to multiply a vector by a > matrix > that is empty (that is, has zero columns and/or rows). Have you run the > code > in a debugger to see which matrix this is? > > Best > W. > > > -- > > Wolfgang Bangerth email: bang...@colostate.edu > www: http://www.math.colostate.edu/~bangerth/ > > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/5757b61c-20e4-4933-9376-d2301477a93cn%40googlegroups.com.
Re: [deal.II] FullMatrix to SparseMatrix
On 10/16/20 10:35 AM, Nikki Holtzer wrote: The error I'm receiving is: An error occurred in line <179> of file in function void dealii::FullMatrix::vmult(dealii::Vector&, const dealii::Vector&, bool) const [with number2 = double; number = double] The violated condition was: !this->empty() Additional information: (none) The error message states that you are trying to multiply a vector by a matrix that is empty (that is, has zero columns and/or rows). Have you run the code in a debugger to see which matrix this is? Best W. -- Wolfgang Bangerth email: bange...@colostate.edu www: http://www.math.colostate.edu/~bangerth/ -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/3dbd8eab-2070-f747-c668-a2acd26578d2%40colostate.edu.
Re: [deal.II] Clearing a particle properties without getting properties for each particle
I was wondering if there was a more optimal way to do this? I have profiled it with callgrind and it seems that getting the properties array view from the particle can be really expensive. Since what we want to achieve is just to set one of these properties to zero, I was wondering if there was not a possible optimisation? For example, could we just get the array view once and assuming its continuity, set all of the same property to zero? That seems strange to me. The get_properties() function is in essence a one-liner with a few indirections. Can you show the code in which you set properties to zero? Best W. -- Wolfgang Bangerth email: bange...@colostate.edu www: http://www.math.colostate.edu/~bangerth/ -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/9608da77-8e1c-2355-7ce8-a5545df10766%40colostate.edu.
Re: [deal.II] Velocity laplacians
On 10/16/20 5:16 PM, Àlex Jarauta wrote: I have managed to fix the problem, I was only updating the hessians in the residuals, but not in my LHS matrix. So let me guess -- you weren't running in debug mode when you got the NaNs? ;-) Cheers W. -- Wolfgang Bangerth email: bange...@colostate.edu www: http://www.math.colostate.edu/~bangerth/ -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/1db32a73-94ac-68a2-e14e-abe314f036ca%40colostate.edu.