Thanks, !
I tried in a way you advised. so, now i tried.
template <int dim>
void Magnitude<dim>::compute_derived_quantities_vector (
const std::vector<Vector<
double> > &uh,
const
std::vector<std::vector<Tensor<1, dim> > > & /*duh*/,
const
std::vector<std::vector<Tensor<2, dim> > > & /*dduh*/,
const
std::vector<Point<dim> > & /*normals*/,
const
std::vector<Point<dim> > & /*evaluation_points*/,
std::vector<Vector<double>
> &computed_quantities) const
{
for (unsigned int i=0; i<computed_quantities.size(); i++)
{ Assert(computed_quantities[i].size() == 1,
ExcDimensionMismatch (computed_quantities[i].size(), 1));
*Assert(uh[i].size() == **3, ExcDimensionMismatch (uh[i].size(),
3));*
computed_quantities[i](0) = std::sqrt(uh[i](0)*uh[i](0) + uh[i](1
)*uh[i](1));
}
}
and I use it as ...
template <int dim>
void
StokesProblem<dim>::output_results (const unsigned int
refinement_cycle) const
{ [...]
DataOut<dim> data_out;
data_out.attach_dof_handler (dof_handler);
data_out.add_data_vector (solution, solution_names,
DataOut<dim>::type_dof_data,
data_component_interpretation);
*// added*
* Magnitude<dim> magnitude;*
* data_out.add_data_vector (solution, magnitude); //here solution
is block-vector solution *
* // added - end ;*
data_out.build_patches ();
std::ostringstream filenameeps;
filenameeps << "solution-"<< Utilities::int_to_string
(refinement_cycle, 2)<< ".vtk";
std::ofstream output (filenameeps.str().c_str());
data_out.write_vtk (output);
[...]
}
but now I receive a error message as...where I don't have clue what's wrong
now...
do you have any idea of it ?
*An error occurred in line <114> of file
</Users/kimjaekwang/dealii-8.4.1/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 9MagnitudeILi2EE 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.*
On Wednesday, July 19, 2017 at 5:23:36 PM UTC-5, Wolfgang Bangerth wrote:
>
> On 07/19/2017 04:09 PM, Jaekwang Kim wrote:
> >
> > because my dof_handler has doc for pressure, size does not match...
> >
> > how can I avoid this problem ?
>
> You just need to pass the *entire* solution vector, not just the first
> block. Otherwise, DataOut cannot find out which elements of the vector
> correspond to the degrees of freedom enumerated in your DoFHandler.
>
> You will also have to change this:
>
> Magnitude<dim>::compute_derived_quantities_vector ([...])
> {
> [...]
> Assert(uh[i].size() == 2, ExcDimensionMismatch (uh[i].size(), 2));
> [...]
>
> The size will now be 3 (or probably dim+1), even though you are only
> using the zeroth and first component of uh in computing the magnitude.
>
> Best
> W.
>
> --
> ------------------------------------------------------------------------
> Wolfgang Bangerth email: [email protected]
> <javascript:>
> 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.