Re: [deal.II] how to use post_processor for FE_System

2017-07-29 Thread Wolfgang Bangerth

On 07/20/2017 08:02 AM, Jaekwang Kim wrote:


1. the 'grad_u' vector I actually receiving is all zero vector I checked 
and it always gives me (dudx,dudy)=(0,0)
2. I need to use p[0] value, and I believe 'evaluation_points[q](0)' is what I 
need.

but when I extract value I am receiving error as...



Are you passing the update_gradients and update_quadrature_points flags from 
your class to make sure that these two fields are actually filled?


Best
 W.

--
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.


Re: [deal.II] how to use post_processor for FE_System

2017-07-20 Thread Jaekwang Kim
Thanks!! 
By the way, can I ask another? 

Actually, the quantity that I'm going to calculate is \dot(gamma), 
More explicitly...I attach one figure 


So I modified post processor as, 

template 

void Magnitude::compute_derived_quantities_vector (

   const std::vector > & uh,

   const 
std::vector > >   & duh,

   const 
std::vector > >   & /*dduh*/,

   const 
std::vector > & /*normals*/,

   const 
std::vector > & evaluation_points,

   std::vector 
>   & computed_quantities) const

{

//const unsigned int n_quadrature_points = uh.size();



for (unsigned int i=0; i grad_u;

for (unsigned int d=0; d shear_rate_tensor = symmetrize 
(grad_u);

computed_quantities[q](0) = shear_rate_tensor * shear_rate_tensor + 
std::pow( (uh[q](0) /evaluation_points[q](0)),2) );



}

}


but I got problem in two ways

1. the 'grad_u' vector I actually receiving is all zero vector I 
checked and it always gives me (dudx,dudy)=(0,0)
2. I need to use p[0] value, and I believe 'evaluation_points[q](0)' is 
what I need. 
but when I extract value I am receiving error as...

*grad_u: 0 , 0*

*make[3]: *** [CMakeFiles/run] Segmentation fault: 11*

*make[2]: *** [CMakeFiles/run.dir/all] Error 2*

*make[1]: *** [CMakeFiles/run.dir/rule] Error 2*

*make: *** [run] Error 2*


*Thanks...*

*Jaekwang *
 


On Wednesday, July 19, 2017 at 6:02:14 PM UTC-5, Wolfgang Bangerth wrote:
>
> On 07/19/2017 05:00 PM, Jaekwang Kim wrote: 
> > /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./ 
>
> Have you looked here? :-) 
>
> (The answer is that the `Magnitude` object needs to live at least as 
> long as the `DataOut` object. You should declare it *before* the 
> `DataOut` object.) 
>
> Cheers 
>   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.


Re: [deal.II] how to use post_processor for FE_System

2017-07-19 Thread Wolfgang Bangerth

On 07/19/2017 05:00 PM, Jaekwang Kim wrote:
/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./


Have you looked here? :-)

(The answer is that the `Magnitude` object needs to live at least as 
long as the `DataOut` object. You should declare it *before* the 
`DataOut` object.)


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.
For more options, visit https://groups.google.com/d/optout.


Re: [deal.II] how to use post_processor for FE_System

2017-07-19 Thread Jaekwang Kim

Thanks, !

I tried in a way you advised. so, now i tried. 



template 

void Magnitude::compute_derived_quantities_vector (

   const std::vector > &uh,

   const 
std::vector > >   & /*duh*/,

   const 
std::vector > >   & /*dduh*/,

   const 
std::vector > & /*normals*/,

   const 
std::vector > & /*evaluation_points*/,

   std::vector 
>   &computed_quantities) const

{

for (unsigned int i=0; i

void

StokesProblem::output_results (const unsigned int 
refinement_cycle)  const

{   [...]   

DataOut data_out;

data_out.attach_dof_handler (dof_handler);

data_out.add_data_vector (solution, solution_names,

  DataOut::type_dof_data,

  data_component_interpretation);



*// added*

*Magnitude 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 
 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: )*


*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::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: 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.


Re: [deal.II] how to use post_processor for FE_System

2017-07-19 Thread Wolfgang Bangerth

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::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: 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.
For more options, visit https://groups.google.com/d/optout.


[deal.II] how to use post_processor for FE_System

2017-07-19 Thread Jaekwang Kim

Hi, all 

I was practicing using post_processor, referring step-29 and step 31. 

If I want to use post_processor for vector-valued problem, where my 
solution is (u,v,p)

and I want to compute magnitude of velocity,  |u^2+v^2| ignoring pressure 
parts. 

i wrote as step 29; 

template 

class Magnitude : public DataPostprocessorScalar

{

public:

Magnitude ();



virtual

void

compute_derived_quantities_vector (const std::vector >   
&uh,

   const std::vector > > &duh,

   const std::vector > > &dduh,

   const std::vector >   
&normals,

   const std::vector >   
&evaluation_points,

   std::vector > 
&computed_quantities) const;

  

};



template 

Magnitude::Magnitude ()

:

DataPostprocessorScalar ("ShearRate", update_values)

{}

// Remember that this function may only use data for which the

// respective update flag is specified by


template 

void

Magnitude::compute_derived_quantities_vector (

  const 
std::vector > &uh,

  const 
std::vector > >   & /*duh*/,

  const 
std::vector > >   & /*dduh*/,

  const 
std::vector > & /*normals*/,

  const 
std::vector > & /*evaluation_points*/,

  
std::vector >   &computed_quantities

  ) const

{

for (unsigned int i=0; i

void

StokesProblem::output_results (const unsigned int 
refinement_cycle)  const

{





std::vector solution_names (dim, "velocity");

solution_names.push_back ("pressure");




std::vector

data_component_interpretation

(dim, DataComponentInterpretation::component_is_part_of_vector);

data_component_interpretation

.push_back (DataComponentInterpretation::component_is_scalar);



DataOut data_out;

data_out.attach_dof_handler (dof_handler);

data_out.add_data_vector (solution, solution_names,

  DataOut::type_dof_data,

  data_component_interpretation);



// added

Magnitude magnitude;

*data_out.add_data_vector (solution.block(**0), magnitude); 
 //because I only want to process velocity solution*

// added - end ;





data_out.add_data_vector (cellwise_shear_rate,"Shear_rate");

data_out.add_data_vector (cellwise_viscosity,"Viscosity");

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 I get error like 


*An error occurred in line <1022> of file 
 in 
function*

*void dealii::DataOut_DoFData, 2, 
2>::add_data_vector(const VectorType &, const 
DataPostprocessor &) [VectorType = 
dealii::Vector]*

*The violated condition was: *

*vec.size() == dofs->n_dofs()*

*The name and call sequence of the exception was:*

*Exceptions::DataOut::ExcInvalidVectorSize (vec.size(), dofs->n_dofs(), 
dofs->get_triangulation().n_active_cells())*

*Additional Information: *

*The vector has size 238 but the DoFHandler object says that there are 274 
degrees of freedom and there are 24 active cells. The size of your vector 
needs to be either equal to the number of degrees of freedom, or equal to 
the number of active cells.*




because my dof_handler has doc for pressure, size does not match... 

how can I avoid this problem ?  


-- 
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.