Respected Prof. Bangerth, I read the FAQs page. As I understand now, it is because of the vector being deleted while some object is still pointing to it.
I have tried several things. I have kept the declaration of the vector in the header file which means that the vector is not destroyed after exiting the function and so this error should not occur. I suspect it is because of this information mention in the class documentation : "To enable the use of the MappingQ1Eulerian <https://www.dealii.org/8.4.0/doxygen/deal.II/classMappingQ1Eulerian.html> class also in the context of parallel codes using the PETSc wrapper classes, the type of the vector can be specified as template parameter EulerVectorType Not specifying this template argument in applications using the PETSc vector classes leads to the construction of a copy of the vector which is not accessible afterwards!" I am using Petsc vector class. How do I use this template parameter EulerVectorType? MappingQEulerian<dim,EulerVectorType> eulerian_mapping(2, dof_handler, displacement_vector); // mapping to map the mesh to reference configuration It gives error that error: ‘EulerVectorType’ was not declared in this scope On Friday, March 31, 2017 at 11:15:54 PM UTC-4, RAJAT ARORA wrote: > > Hello, > > Since I am moving the mesh physically, the current coordinates are of the > current configuration. I am trying to make a new fe_values object with > mapping as shown below but I am getting an error > > An error occurred in line <114> of file </home/rajat/Documents/Code- > Libraries/deal/dealii8.3/dealii-8.3.0/source/base/subscriptor.cc> in > function > virtual dealii::Subscriptor::~Subscriptor() > The violated condition was: > counter == 0 > The name and call sequence of the exception was: > ExcInUse (counter, object_info->name(), infostring) > Additional Information: > Object of class N6dealii6VectorIdEE is still used by 1 other objects. > > > (Additional information: <none>) > > > See the entry in the Frequently Asked Questions of deal.II (linked to from > http://www.dealii.org/) for a lot more information on what this error > means and how to fix programs in which it happens. > > > Stacktrace: > ----------- > #0 > > /home/rajat/Documents/Code-Libraries/deal/dealii8.3/installed-dealii/lib/libdeal_II.g.so.8.3.0: > > dealii::Subscriptor::~Subscriptor() > #1 ./fdm: dealii::Vector<double>::~Vector() > #2 ./fdm: VelocityEquation<3>::doutput_velocity() > #3 ./fdm: AdiabaticShearBand<3>::Run_QuasiStatic() > #4 ./fdm: AdiabaticShearBand<3>::run() > #5 ./fdm: main > -------------------------------------------------------- > > > The code I use is: > > doutput_velocity() > { > DataOut<dim> data_out; > > data_out.attach_dof_handler (this->dof_handler); > > //LA::MPI::Vector displacement_vector is defined in the header file > of the class. > displacement_vector.reinit(this->locally_owned_dofs, mpi_communicator > ); > > > displacement_vector = X; // X is reference coordinates. > > > displacement_vector -= fdm->x; // negative of displacement, x is > current coordinates > > > MappingQEulerian<dim> eulerian_mapping(2, dof_handler, > displacement_vector); // mapping to map the mesh to reference > configuration > > > FEValues<dim> euler_fe_values(eulerian_mapping, this->fe, fdm-> > quadrature_formula, update_values | > update_quadrature_points | > update_JxW_values); > > } > > Also, If I comment the last two lines, there is no error. I am not sure > what is wrong. > > Any suggestions will be appreciated. Thanks. > > On Thursday, March 30, 2017 at 1:31:35 PM UTC-4, Jean-Paul Pelteret wrote: >> >> Either that or create an inverse mapping that maps back from the current >> to the reference configuration. This method could potentially introduce to >> some numerical error though. >> >> On Thursday, March 30, 2017 at 6:57:12 PM UTC+2, Wolfgang Bangerth wrote: >>> >>> >>> Rajat, >>> >>> > I am updating my mesh after every time-increment. So, cell->vertex(v) >>> > contains the current coordinates of the mesh. I know the coordinates >>> of >>> > the cell (and whole mesh) at t = 0, I wanted >>> > to know how I can initialize the fe_values object wrt to the >>> coordinates >>> > of the cell at t = 0. >>> > >>> > If possible, this will enable me to use >>> > fe_values->get_function_gradients() and fe_values->shape_grad() to get >>> > the gradients wrt to reference mesh. >>> >>> You can't. The FEValues classes only consider the mesh as it is right >>> now, not how it was a while ago. >>> >>> But you could consider leaving the mesh as it is (i.e., in reference >>> coordinates) and using MappingQEulerian to describe the displacement. >>> Then, if you use an FEValues without a mapping, you get everything with >>> regard to the original (reference) configuration. If you use an FEValues >>> with the mapping, you get the current configuration. >>> >>> 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. For more options, visit https://groups.google.com/d/optout.