Re: [deal.II] Re: AMR , how to pass solution vector to refined mesh

2017-03-21 Thread Jaekwang Kim
Thank you!!
Just got what've meant. 
and fixed my code properly

Thanks ! 

Jaekwang Kim 

2017년 3월 21일 화요일 오후 12시 55분 7초 UTC-4, Jean-Paul Pelteret 님의 말:
>
> Hi Jaekwang,
>
> No, you've misunderstood in that I was just showing that to you as an 
> example. You don't need to use that exact Vector class. You were nearly at 
> the answer with what you've posted - you just need to read the compiler 
> error more carefully to understand what its telling you is wrong. The 
> deal.II BlockVector class is templatised on a number type, so must pass the 
> arguments along with the vector type when defining the vector template 
> argument of the SolutionTransfer class. So, in your case, this would be
>
> SolutionTransfer solution_transfer(dof_handler);
>>
>
> This I suspect will fix the problem you've shown above.
>
> Regards,
> Jean-Paul 
>

-- 
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] Re: AMR , how to pass solution vector to refined mesh

2017-03-21 Thread Jean-Paul Pelteret
Hi Jaekwang,

No, you've misunderstood in that I was just showing that to you as an 
example. You don't need to use that exact Vector class. You were nearly at 
the answer with what you've posted - you just need to read the compiler 
error more carefully to understand what its telling you is wrong. The 
deal.II BlockVector class is templatised on a number type, so must pass the 
arguments along with the vector type when defining the vector template 
argument of the SolutionTransfer class. So, in your case, this would be

SolutionTransfer solution_transfer(dof_handler);
>

This I suspect will fix the problem you've shown above.

Regards,
Jean-Paul 

-- 
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] Re: AMR , how to pass solution vector to refined mesh

2017-03-21 Thread Jaekwang Kim
thank you for your response. 
I am trying to following this... 

but it seems that I have to use the class, 
* SolutionTransfer* to  transfer 
block vector 

Without using MPI, isn't it possible to assess this class? like... 
SolutionTransfer , while it shows error ,

*error: **use of*

*  class template 'BlockVector' requires template arguments*

*SolutionTransfer 
solution_transfer(dof_handler)...*

* ^~~*

*/Users/kimjaekwang/Programs/dealii/include/deal.II/n*

For now I don't have mpi in my computer.If there is no way to do this 
without using MPI, i have to install..


Thank you. 



2017년 3월 21일 화요일 오전 4시 25분 37초 UTC-4, Jean-Paul Pelteret 님의 말:
>
> Dear Jaekwang,
>
> Step-31  
> demonstrates 
> how to use the SolutionTransfer class with BlockVectors. In short, you need 
> to specify the vector type as a template argument to the class. Here's how 
> its done in that tutorial:
>
> SolutionTransfer 
> 
> temperature_trans(temperature_dof_handler); // non-block vector
> SolutionTransfer 
> 
> stokes_trans(stokes_dof_handler); // block vector
> triangulation.prepare_coarsening_and_refinement 
> 
> ();
> temperature_trans.prepare_for_coarsening_and_refinement(x_temperature);
> stokes_trans.prepare_for_coarsening_and_refinement(x_stokes);
>
> I hope this helps,
> Jean-Paul
>
> On Tuesday, March 21, 2017 at 12:26:59 AM UTC+1, Jaekwang Kim wrote:
>>
>> Dear, Dr. Bangerth
>>
>> Adding up to this, may I ask you one more question?
>>
>> After this,,, I was trying to transfer my block vector solution through 
>> Solutiontransfer class. but I am having difficulty in this. 
>>
>> For example, I have fluid problem vector value solution (u_x, u_y, 
>> pressure)
>>
>> at refie_mesh function, I tried...
>>
>> template 
>>
>> void
>>
>> StokesProblem::refine_mesh () //AMR based on VELOCITY GRADIENT
>>
>> {
>>
>>
>>  const FEValuesExtractors::Vector velocities (0);
>>
>> 
>>
>>  Vector estimated_error_per_cell 
>> (triangulation.n_active_cells());
>>
>> 
>>
>>  KellyErrorEstimator::estimate (dof_handler,QGauss> >(degree+1),typename FunctionMap::type(),
>>
>>  solution,estimated_error_per_cell, 
>> fe.component_mask(velocities));
>>
>>  
>>
>>  GridRefinement::refine_and_coarsen_fixed_number 
>> (triangulation,estimated_error_per_cell,0.3, 0.0);
>>
>> 
>>
>> triangulation.prepare_coarsening_and_refinement ();
>>
>>
>>
>> SolutionTransfer solution_transfer(dof_handler); *// Here 
>> my doc hander might include all (u,v,p) solution *
>>
>>
>>
>>
>>
>> After this I reinitialized my previous solution, where my current 
>> solution will be interpolated, for newly refined dof_handler. 
>>
>> And When I tried to transfer my solution 
>>
>>
>> 
>> solution_transfer.prepare_for_coarsening_and_refinement(solution.block(0
>> ));
>>
>> *//since this function only takes vector type inputs... I assume 
>> that I cannot transfer whole solution (u,v,p) at once? *
>>
>> 
>>
>> triangulation.execute_coarsening_and_refinement();
>>
>> 
>>
>> 
>>
>> //Transfer solution
>>
>> solution_transfer.interpolate(solution.block(0), 
>> previous_solution.block(0));
>>
>> 
>>
>> 
>> solution_transfer.prepare_for_coarsening_and_refinement(solution.block(1
>> ));
>>
>> 
>>
>> solution_transfer.interpolate(solution.block(1), 
>> previous_solution.block(1));
>>
>>
>> but I run into this error. 
>> I think it is because there two lines are conflicting  because they 
>> don't have same number of dof_handler...
>>
>> 1. SolutionTransfer solution_transfer(dof_handler);
>>
>> 2. 
>> solution_transfer.prepare_for_coarsening_and_refinement(solution.block(0
>> ));
>>
>> will there be other easy way I can transfer vector-valued solution 
>> without having this difficulty? 
>>
>> I always appreciate your help !
>>
>> Thanks
>>
>> Jaekwang Kim 
>>
>> *An error occurred in line <253> of file 
>>  in 
>> function*
>>
>> *void dealii::SolutionTransfer<2, dealii::Vector, 
>> dealii::DoFHandler<2, 2> >::prepare_for_coarsening_and_refinement(const 
>> std::vector &) [dim = 2, VectorType = dealii::Vector, 
>> DoFHandlerType = dealii::DoFHandler<2, 2>]*
>>
>> *The violated condition was: *
>>
>> *all_in[i].size()==n_dofs_old*
>>
>> *The name and call sequence of the exception was:*
>>
>> *

Re: [deal.II] How to make G vector in lecture 21.65

2017-03-21 Thread Wolfgang Bangerth

On 03/21/2017 05:11 AM, hanks0...@gmail.com wrote:


At first, the reason why I would like to make vector G by myself (without
using VectorTools::interpolate_boundary_values) is that I would like to input
calculated values (not just function of position) on the boundary.

I would like to solve free boundary problem. So, the boundary condition would
be calculated from sources(current in coils) and line integral of green
function and so on

Especially, the calculation of boundary values includes the line integral,
that is why I want to use an assembly step.

So, do you think it is hard to apply boundary condition without using
VectorTools::interpolate_boundary_values...?


No. But I would advise to take a look at the implementation of that function 
(in include/deal.II/numerics/vector_tools.template.h IIRC).


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.


Re: [deal.II] How to make G vector in lecture 21.65

2017-03-21 Thread hanks0227
Dr. Bangerth,

Thank you for the kind explanation.

Now, I understand what is wrong...

I'm really sorry but, could I have one more question?

>
> The approach you use, making things look like an assembly step, is not 
> appropriate for what you want to do. I would just call 
> VectorTools::interpolate_boundary_values to get the pairs of dof_index 
> and value, and then convert the result of that function into a vector. 
>
> At first, the reason why I would like to make vector G by myself (without 
using VectorTools::interpolate_boundary_values) is that I would like to 
input calculated values (not just function of position) on the boundary.

I would like to solve free boundary problem. So, the boundary condition 
would be calculated from sources(current in coils) and line integral of 
green function and so on

Especially, the calculation of boundary values includes the line integral, 
that is why I want to use an assembly step.

So, do you think it is hard to apply boundary condition without using 
VectorTools::interpolate_boundary_values...? 

Thank you.

Kyusik.
 

-- 
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] Re: How to compute Nédélec gradient

2017-03-21 Thread Daniel Arndt



I'm solving a 2D problem on quadrilateral cartesian mesh using FE_Q(1) 
> elements.
> I would like to compute the gradient of the bilinear solution, known to 
> belong to the FE_Nedelec(0) space: how can I manage to do it?
>
For visualizing the gradient of discrete solution, you have multiple 
options.
If you are using FE_Q(1) elements most visualization tools, should be able 
to give you an exact representation of your discrete solution.
In Paraview, for example, you could just use the filter "Gradient of 
Unstructured DataSet".
Another way would be to use DataPostprocessor [1]. Have a look at 
step-29[2] for how to use it. 
 

> In particular I'm only interested in computing the tangential component of 
> the gradient on each mesh face, but I don't really know (and can't find 
> anything on the documentation) how to approach the problem of building a 
> gradient vector associated with the Nédélec degrees of freedom.
>
What do you actually want to do with the tangential gradients at the faces? 
Is visualizing sufficient for you or do you really want to compute a 
projection into the FE_Nedelec(0) space?

Best,
Daniel

[1] https://www.dealii.org/8.4.0/doxygen/deal.II/classDataPostprocessor.html
[2] https://www.dealii.org/8.4.0/doxygen/deal.II/step_29.html 

-- 
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] Re: AMR , how to pass solution vector to refined mesh

2017-03-21 Thread Jean-Paul Pelteret
Dear Jaekwang,

Step-31  
demonstrates 
how to use the SolutionTransfer class with BlockVectors. In short, you need 
to specify the vector type as a template argument to the class. Here's how 
its done in that tutorial:

SolutionTransfer 

temperature_trans(temperature_dof_handler); // non-block vector
SolutionTransfer 

stokes_trans(stokes_dof_handler); // block vector
triangulation.prepare_coarsening_and_refinement 

();
temperature_trans.prepare_for_coarsening_and_refinement(x_temperature);
stokes_trans.prepare_for_coarsening_and_refinement(x_stokes);

I hope this helps,
Jean-Paul

On Tuesday, March 21, 2017 at 12:26:59 AM UTC+1, Jaekwang Kim wrote:
>
> Dear, Dr. Bangerth
>
> Adding up to this, may I ask you one more question?
>
> After this,,, I was trying to transfer my block vector solution through 
> Solutiontransfer class. but I am having difficulty in this. 
>
> For example, I have fluid problem vector value solution (u_x, u_y, 
> pressure)
>
> at refie_mesh function, I tried...
>
> template 
>
> void
>
> StokesProblem::refine_mesh () //AMR based on VELOCITY GRADIENT
>
> {
>
>
>  const FEValuesExtractors::Vector velocities (0);
>
> 
>
>  Vector estimated_error_per_cell 
> (triangulation.n_active_cells());
>
> 
>
>  KellyErrorEstimator::estimate (dof_handler,QGauss >(degree+1),typename FunctionMap::type(),
>
>  solution,estimated_error_per_cell, fe.component_mask(velocities));
>
>  
>
>  GridRefinement::refine_and_coarsen_fixed_number 
> (triangulation,estimated_error_per_cell,0.3, 0.0);
>
> 
>
> triangulation.prepare_coarsening_and_refinement ();
>
>
>
> SolutionTransfer solution_transfer(dof_handler); *// Here 
> my doc hander might include all (u,v,p) solution *
>
>
>
>
>
> After this I reinitialized my previous solution, where my current solution 
> will be interpolated, for newly refined dof_handler. 
>
> And When I tried to transfer my solution 
>
>
> 
> solution_transfer.prepare_for_coarsening_and_refinement(solution.block(0
> ));
>
> *//since this function only takes vector type inputs... I assume 
> that I cannot transfer whole solution (u,v,p) at once? *
>
> 
>
> triangulation.execute_coarsening_and_refinement();
>
> 
>
> 
>
> //Transfer solution
>
> solution_transfer.interpolate(solution.block(0), 
> previous_solution.block(0));
>
> 
>
> 
> solution_transfer.prepare_for_coarsening_and_refinement(solution.block(1
> ));
>
> 
>
> solution_transfer.interpolate(solution.block(1), 
> previous_solution.block(1));
>
>
> but I run into this error. 
> I think it is because there two lines are conflicting  because they 
> don't have same number of dof_handler...
>
> 1. SolutionTransfer solution_transfer(dof_handler);
>
> 2. solution_transfer.prepare_for_coarsening_and_refinement(solution.block(
> 0));
>
> will there be other easy way I can transfer vector-valued solution without 
> having this difficulty? 
>
> I always appreciate your help !
>
> Thanks
>
> Jaekwang Kim 
>
> *An error occurred in line <253> of file 
>  in 
> function*
>
> *void dealii::SolutionTransfer<2, dealii::Vector, 
> dealii::DoFHandler<2, 2> >::prepare_for_coarsening_and_refinement(const 
> std::vector &) [dim = 2, VectorType = dealii::Vector, 
> DoFHandlerType = dealii::DoFHandler<2, 2>]*
>
> *The violated condition was: *
>
> *all_in[i].size()==n_dofs_old*
>
> *The name and call sequence of the exception was:*
>
> *ExcDimensionMismatch(all_in[i].size(),n_dofs_old)*
>
> *Additional Information: *
>
> *Dimension 238 not equal to 274*
>
>
>
>
>

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