On 4/25/19 4:51 AM, [email protected] wrote: > > std::vector<Vector<double> > solution_old_values(n_q_points); > > While assembling the system over all cells I call > > fe_values.get_function_values (solution_old, solution_old_values); > > In the Step-21 tutorial, they call > > const double old_s = old_solution_values[q](dim+1); > > to get the dim+2 component of the vector. > > Up to here, everything compiles fine, but I dont know how to apply the values > correctly > Therefore I have the following two questions: > > Do I simply have to call: const double solution_o = solution_old_values[q](0); > to get the velocity component? In fact they are vector-valued, so a double > doesn't make sense that much.
Correct. The vector should be a `Tensor<1,dim>` and you would have to copy the first `dim` components of `solution_old_values[q]` into the tensor. That's burdensome, so I would suggest that instead you use extractors: std::vector<Tensor<1,dim>> old_velocity_values(n_q_points); fe_values[velocities].get_function_values (...); and then you already have (only) the velocities and in their right data type. > And thus my second question is: Do I apply the value correctly to the local > matrix > by calling: > local_matrix(i,j) += solution_o * fe_values[velocities].shape_value(i,q) * > fe_values[velocities].shape_value(j,q); This looks funny. You are multiplying a scalar 'solution_o' and phi_i*phi_j where the latter two are vectors. This works, of course, but didn't you want solution_o to be a vector as well? You are also missing the JxW. Best W. -- ------------------------------------------------------------------------ Wolfgang Bangerth email: [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
