[deal.II] Does MappingFEField apply to all cells ?

2016-08-19 Thread Praveen C
Hello

I am using MappingFEField to get high order meshes which I construct by
solving Winslow equations.

I set initial condition and save it to file with 3 patches. As the figure
shows, it seems to me that the MappingFEField is used only for the cells
adjacent to the boundary. Is this what is happening ?

MappingQ has an option to use it on all cells but no such option is seen in
MappingFEField.

Thanks
praveen

-- 
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] Efficient implementation of varying Dirichlet BCs when everything else in the system is constant

2016-08-19 Thread Wolfgang Bangerth

On 08/19/2016 05:04 PM, David F wrote:

Thank you, I'll take a look in detail at those examples. However, those
examples don't use PETSc and the problem is that I can't find any method in
PETScWrappers::SparseMatrix to copy a matrix. Which way would you suggest?


Oh, I see, that is a problem. I think the simplest and most efficient way to 
go about this is to see whether PETSc has the ability to copy its own 
matrices, and then add a member function to the PETScWrappers::SparseMatrix 
class that uses this functionality.


(It would of course be fantastic if this function then makes its way into 
deal.II itself -- with which we'd be happy to help!)


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] Efficient implementation of varying Dirichlet BCs when everything else in the system is constant

2016-08-19 Thread David F
Thank you, I'll take a look in detail at those examples. However, those 
examples don't use PETSc and the problem is that I can't find any method in 
PETScWrappers::SparseMatrix to copy a matrix. Which way would you suggest? 

David.


On Saturday, 20 August 2016 00:41:05 UTC+2, Wolfgang Bangerth wrote:
>
> On 08/19/2016 04:23 PM, David F wrote: 
> > 
> > P.S.: I tried to simply repeat the process to re-apply the BCs with a 
> new 
> > value using the same matrix, but I get always the first BCs I apply  (I 
> think 
> > because once I apply it, the matrix knows it has been already condensed 
> and 
> > ignores the next calls). 
>
> Yes. What you need to do is in every time step copy the matrix you have 
> previously assembled into a new matrix, call apply_boundary_values() to 
> this 
> matrix and your current right hand side, and then solve the linear system. 
> This way, you always start from the same matrix. 
>
> I think one of steps 23, 24, 25, 26 does this. 
>
> Best 
>   Wolfgang 
>
> -- 
>  
> 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] Efficient implementation of varying Dirichlet BCs when everything else in the system is constant

2016-08-19 Thread Wolfgang Bangerth

On 08/19/2016 04:23 PM, David F wrote:


P.S.: I tried to simply repeat the process to re-apply the BCs with a new
value using the same matrix, but I get always the first BCs I apply  (I think
because once I apply it, the matrix knows it has been already condensed and
ignores the next calls).


Yes. What you need to do is in every time step copy the matrix you have 
previously assembled into a new matrix, call apply_boundary_values() to this 
matrix and your current right hand side, and then solve the linear system. 
This way, you always start from the same matrix.


I think one of steps 23, 24, 25, 26 does this.

Best
 Wolfgang

--

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] Efficient implementation of varying Dirichlet BCs when everything else in the system is constant

2016-08-19 Thread David F
Hello everyone, I looked in the forum, in the documentation and in the 
tutorials but I couldn't find a way to solve this problem in the way I 
need. I would appreciate a lot any help you could provide me. 


I would like to have Dirichlet BCs applied to faces with some boundary id. 
This id is not changing (i.e., the constrained faces are always the same), 
and the mesh, elastic properties etc. are also constant throughout the 
program. The function used to define these BCs has always the same shape, 
the only thing that is changing is the value of the Dirichlet BCs (e.g., 
imagine that first you constrain the displacement of a face with a 
spatially-constant value of 1.0 through the face, and in the next solution 
step to 2.0 and so on). I need to solve this system many times, each time 
with a different value of the Dirichlet BCs. To do this efficiently, I 
would like to precalculate as much as possible, for example, assembling the 
system matrix only once etc. 

Now my question is, given that the sparsity pattern is not changing (as the 
constrained nodes are the same), is there a way to solve this in a manner 
such that only the solution and rhs are changing from one step to the next? 
If the answer is that the system matrix must necessarily change, which 
should be the strategy to reassemble only the changing cells (and avoiding 
thus reassembling the whole matrix)? In summary, what's the most efficient 
way to repeatedly solve a system in which the only changes from step to 
step are the value (not the region over which they are applied) of the 
Dirichlet BCs?



About my current implementation:

I don't have hanging nodes, and I'm using PETScWrappers::MPI::
SparseMatrix and PETScWrappers::MPI::Vector.

I assemble the matrix with

void  distribute_local_to_global 

 
(const FullMatrix 
< typename 
MatrixType::value_type > &local_matrix, const std::vector< size_type 

 
> &local_dof_indices, MatrixType &global_matrix) const 
and apply the BCs with

void interpolate_boundary_values 

 
(const DoFHandlerType &dof, const types::boundary_id 

 
boundary_component, const Function 
< 
DoFHandlerType::space_dimension, double > &boundary_function, std::map< 
types::global_dof_index 
,
 
double > &boundary_values, const ComponentMask 
 
&component_mask=ComponentMask 
())

void apply_boundary_values 

 
(const std::map< types::global_dof_index 
,
 
double > &boundary_values, PETScWrappers::MPI::SparseMatrix 

 
&matrix, PETScWrappers::MPI::Vector 

 
&solution, PETScWrappers::MPI::Vector 

 
&right_hand_side, const bool eliminate_columns=true)




P.S.: I tried to simply repeat the process to re-apply the BCs with a new 
value using the same matrix, but I get always the first BCs I apply  (I 
think because once I apply it, the matrix knows it has been already 
condensed and ignores the next calls).

-- 
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] Efficient implementation of varying Dirichlet BCs when everything else in the system is constant

2016-08-19 Thread David F
Hello everyone, I looked in the forum, in the documentation and in the 
tutorials but I couldn't find a way to solve this problem in the way I 
need. I would appreciate a lot any help you could provide me. 


I would like to have Dirichlet BCs applied to faces with some boundary id. 
This id is not changing (i.e., the constrained faces are always the same), 
and the mesh, elastic properties etc. are also constant throughout the 
program. The function used to defined these BCs has always the same shape, 
the only thing that is changing is the value of the Dirichlet BCs (e.g., 
imagine that first you constrain the displacement of a face with a 
spatially-constant value of 1.0 through the face, and in the next solution 
step to 2.0 and so on). I need to solve this system many times, each time 
with a different value of the Dirichlet BCs. To do this efficiently, I 
would like to precalculate as much as possible, for example, assembling the 
system matrix only once etc. 

Now my question is, given that the sparsity pattern is not changing (as the 
constraints nodes are the same), is there a way to solve this in a manner 
such that only the solution and rhs are changing from one step to the next? 
If the answer is that the system matrix must necessarily change, which 
should be the strategy to reassemble only the changing cells (and avoiding 
thus reassembling the whole matrix)? In summary, what's the most efficient 
way to repeatedly solve a system in which the only changes from step to 
step are the value (not the region over which they are applied) of the 
Dirichlet BCs?



About my current implementation:

I don't have hanging nodes, and I'm using PETScWrappers::MPI::SparseMatrix 
and PETScWrappers::MPI::Vector.

I assemble the matrix with

void  distribute_local_to_global 

 
(const FullMatrix 
< typename 
MatrixType::value_type > &local_matrix, const std::vector< size_type 

 
> &local_dof_indices, MatrixType &global_matrix) const 
and apply the BCs with

void interpolate_boundary_values 

 
(const DoFHandlerType &dof, const types::boundary_id 

 
boundary_component, const Function 
< 
DoFHandlerType::space_dimension, double > &boundary_function, std::map< 
types::global_dof_index 
,
 
double > &boundary_values, const ComponentMask 
 
&component_mask=ComponentMask 
())

void apply_boundary_values 

 
(const std::map< types::global_dof_index 
,
 
double > &boundary_values, PETScWrappers::MPI::SparseMatrix 

 
&matrix, PETScWrappers::MPI::Vector 

 
&solution, PETScWrappers::MPI::Vector 

 
&right_hand_side, const bool eliminate_columns=true)




P.S.: I tried to simply repeat the process to re-apply the BCs with a new 
value using the same matrix, but I get always the first BCs I apply  (I 
think because once I apply it, the matrix knows it has been already 
condensed and ignores the next calls).

















-- 
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] weakly enforcing an identity - vector mean curvature as the surface laplacian of the identity on a codim-1 manifold

2016-08-19 Thread thomas stephens
Wolfgang, I appreciate your assistance so far.  

I'm getting closer, but I still need some help.  I would like to look at 
this problem as it appears in [1], Equation 27 on p. 11, as the bilinear 
forms are written as integrals, making things more clear.

Below I have set up what I think to be the system for (k_{bar,h})_X  =  - 
(nabla_X v_h, nabla_X id_X)_X - which, in light of Eqn 27 in [1], is really

\integral  k_bar_h \dot v_h = \integral nabla_X id_X : nabla_X v_h


 typename DoFHandler::active_cell_iterator cell = 
dof_handler.begin_active();
  for (; cell!=dof_handler.end(); ++cell)
  {
cell_mass_matrix = 0;
cell_rhs = 0;
fe_values.reinit (cell);

// create lhs mass matrix, (k*nu, v)_ij
for (unsigned int i=0; iget_dof_indices (local_dof_indices);
for (unsigned int i=0; i cg_solver (solver_control);

  const auto inverse_mass_matrix = 
inverse_operator(linear_operator(mass_matrix),
cg_solver,
PreconditionIdentity());
  mean_curvature_vector.reinit(dof_handler.n_dofs());
  mean_curvature_squared.reinit(dof_handler.n_dofs());
  system_rhs *= -1.0;
  inverse_mass_matrix.vmult(mean_curvature_vector,system_rhs);


  std::cout << "mean curvature vector" << mean_curvature_vector << 
std::endl;
  mean_curvature_squared = mean_curvature_vector*mean_curvature_vector;
  std::cout << "mean curvature squared " << mean_curvature_squared << 
std::endl;

 

That is, I do not think I am handling these data structures correctly - 
perhaps that LinearOperator inverse_mass_matrix is not just an ordinary 
dealii::Matrix that I can then apply to dealii::Vectors.



On Thursday, August 18, 2016 at 12:24:23 PM UTC-4, Wolfgang Bangerth wrote:
>
> On 08/18/2016 09:39 AM, thomas stephens wrote: 
> > id_X looks like this: 
> > 
> > | 
> > template 
> > classIdentity:publicFunction 
> > { 
> >   public: 
> > Identity():Function(){} 
> > 
> > 
> > 
> virtualvoidvector_value(constPoint&p,Vector&value)const; 
> > virtualdoublevalue(constPoint&p,constunsignedintcomponent 
> > =0)const; 
> > }; 
> > 
> > Identityid_X(); 
> > | 
> > 
> > 
> > Do I need to implement nabla_X id_Xfrom W.'s expression (v_h, 
> >  k_{bar,h})_X  =  - (nabla_X v_h, nabla_X id_X)_X above,  or is there a 
> > way to convince dealii to do this for me? 
>
> You can interpolate this function onto a finite element function, and 
> then compute its gradient. 
>
> I suspect that it would be simpler to use the form of the surface 
> gradient that involves the normal vector. You know what 
> grad id_X 
> is (namely the identity matrix), from which you can compute 
> grad_X id_X 
> if you know the normal vector (which you should be able to get from X 
> somehow). 
>
> 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] Re: Getting number of hanging support points

2016-08-19 Thread Daniel Arndt
Deepak,

I am aware of the fact that ConstraintMatrix.n_constraints() gives the 
> number of hanging nodes for h-refinement, but if I only use p-refinement, 
> can it give the number of hanging support points occurring due to the 
> difference in the order of bases between two adjacent elements? I am 
> expecting this based on the description of the hp-refinement document.
>
> I have been trying this but always get 0 hanging support points, although 
> I know that the some elements of the mesh use Q1, others Q2.
>
That sounds definitely strange. step-27 uses a hp::DoFHandler and 
make_hanging_node_constraints. Do you see that constraints are created 
there?
If you can't find a solution looking at that example program, can you 
reduce your code to a minimal example showing that no constraints are 
created for p-refinement?

Best,
Daniel

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