Hello all, Following step-7 I am going to apply non-homogeneous Neumann boundary conditions. The problem is that, in step-7, Neumann value is computed using exact solution, however in real-life problems we do not know exact solution beforehand.
Neumann value is computed in step-7 as follows: const double neumann_value = (exact_solution.gradient (fe_face_values.quadrature_point <http://dealii.org/8.4.1/doxygen/deal.II/classFEValuesBase.html#ab1aa3aa2940125b47df95ff82ad733b9>(q_point)) * fe_face_values.normal_vector <http://dealii.org/8.4.1/doxygen/deal.II/classFEValuesBase.html#a130eea0fa89263d93b20521addc830c7> (q_point)); what I have added to my assembly to apply non-homogeneous Neumann boundary conditions follows in which I compute Newman value by red lines: for (unsigned int face_number=0; face_number<GeometryInfo<dim>::faces_per_cell; ++face_number) if (cell->face(face_number)->at_boundary()) { fe_face_values.reinit (cell, face_number); fe_face_values.get_function_gradients(solution, solution_gradients); for (unsigned int q_point=0; q_point<n_q_points_f; ++q_point) { for (unsigned int i=0; i<dofs_per_cell_eta; ++i) { const double neumann_value =solution_eta_gradients[q_point] * fe_face_values_eta.normal_vector(q_point); cell_nl_term(i) += (neumann_value * fe_face_values.shape_value(i,q_point) * fe_face_values.JxW(q_point)); } } } when using above lines I get this error: -------------------------------------------------------- An error occurred in line <1728> of file </home/hbabaei/deal.ii-candi/tmp/unpack/deal.II-v8.4.1/include/deal.II/lac/sparse_matrix.h> in function void dealii::SparseMatrix<number>::add(dealii::SparseMatrix<number>::size_type, dealii::SparseMatrix<number>::size_type, number) [with number = double; dealii::SparseMatrix<number>::size_type = unsigned int] The violated condition was: dealii::numbers::is_finite(value) The name and call sequence of the exception was: ExcNumberNotFinite(std::complex<double>(value)) Additional Information: In a significant number of places, deal.II checks that some intermediate value is a finite number (as opposed to plus or minus infinity, or NaN/Not a Number). In the current function, we encountered a number that is not finite (its value is (nan,0) and therefore violates the current assertion. This may be due to the fact that some operation in this function created such a value, or because one of the arguments you passed to the function already had this value from some previous operation. In the latter case, this function only triggered the error but may not actually be responsible for the computation of the number that is not finite. There are two common cases where this situation happens. First, your code (or something in deal.II) divides by zero in a place where this should not happen. Or, you are trying to solve a linear system with an unsuitable solver (such as an indefinite or non-symmetric linear system using a Conjugate Gradient solver); such attempts oftentimes yield an operation somewhere that tries to divide by zero or take the square root of a negative value. In any case, when trying to find the source of the error, recall that the location where you are getting this error is simply the first place in the program where there is a check that a number (e.g., an element of a solution vector) is in fact finite, but that the actual error that computed the number may have happened far earlier. To find this location, you may want to add checks for finiteness in places of your program visited before the place where this error is produced.One way to check for finiteness is to use the 'AssertIsFinite' macro. Stacktrace: ----------- #0 /home/hbabaei/deal.ii-candi/deal.II-v8.4.1/lib/libdeal_II.g.so.8.4.1: dealii::SparseMatrix<double>::add(unsigned int, unsigned int, double) #1 /home/hbabaei/deal.ii-candi/deal.II-v8.4.1/lib/libdeal_II.g.so.8.4.1: void dealii::ConstraintMatrix::distribute_local_to_global<dealii::SparseMatrix<double>, dealii::Vector<double> >(dealii::FullMatrix<dealii::SparseMatrix<double>::value_type> const&, dealii::Vector<dealii::Vector<double>::value_type> const&, std::vector<unsigned int, std::allocator<unsigned int> > const&, dealii::SparseMatrix<double>&, dealii::Vector<double>&, bool, dealii::internal::bool2type<false>) const #2 ./periodic-serial: PhaseField::Solid<3>::assemble_system_eta() #3 ./periodic-serial: PhaseField::Solid<3>::solve_nonlinear_timestep_eta() #4 ./periodic-serial: PhaseField::Solid<3>::run() #5 ./periodic-serial: main -------------------------------------------------------- It would be appreciated if you could give any hint where I may be making mistake. Thanks Hamed -- 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.