Re: [deal.II] Dealing with conflicting constraints without using VectorTools::interpolate_boundary_values()

2017-03-20 Thread Sogo Shiozawa
Thank you for your quick replay. It seems like the way I assigned the 
condition in if ("certain condition") was not appropriate, and neither do 
the boundary conditions. That was the reason the matrix was invertible. 
After fixing that, it looks working well now. 

Best.
Sogo

On Sunday, March 19, 2017 at 9:55:09 AM UTC-5, Wolfgang Bangerth wrote:
>
>
> > I assign such a boundary condition at points by giving boundary values 
> > to std::map boundary_values directly, and it looks 
> > working well. 
>
> Yes, this is the correct approach. 
>
>
> > However, for handling conflict between hanging node and 
> > boundary condition with ConstraintMatrix, just doing something like: 
> > 
> > typenameDoFHandler::active_cell_iterator cell = 
> dof_handler.begin_active(), 
> > 
> >  endc = 
> > dof_handler.end(); 
> > 
> > for(; cell!=endc; ++cell) 
> > 
> > { 
> > 
> > for(unsignedintvert = 0; vert < 
> GeometryInfo::vertices_per_cell; vert++) 
> > 
> > { 
> > 
> >  if("certain condition") 
> > 
> >  { 
> > 
> > 
>  constraints_update.add_line(cell2->vertex_dof_index(vert,I)); 
> > 
> >  } 
> > 
> > } 
> > 
> > } 
> > 
> > 
> > (Here constraints_update is an object of ConstraintMatrix). 
> > 
> >  does not seem working because the solver eventually gives the error: 
> > [...] 
>
> Well, that means that your matrix is probably not invertible (although the 
> residual does get pretty small -- are you sure you don't just need more 
> iterations?). This *may* be because of your constraints, but it may also 
> be 
> because of any number of other reasons. Have you tried this on a small 
> problem, say a 2x2 or 3x3 mesh, to make sure it really is because of the 
> constraints? For small problems, you can often figure out on a piece of 
> paper 
> what the matrix should be, and compare with what you get from your 
> program. 
>
> 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] Dealing with conflicting constraints without using VectorTools::interpolate_boundary_values()

2017-03-19 Thread Wolfgang Bangerth



I assign such a boundary condition at points by giving boundary values
to std::map boundary_values directly, and it looks
working well.


Yes, this is the correct approach.



However, for handling conflict between hanging node and
boundary condition with ConstraintMatrix, just doing something like:

typenameDoFHandler::active_cell_iterator cell = dof_handler.begin_active(),

 endc =
dof_handler.end();

for(; cell!=endc; ++cell)

{

for(unsignedintvert = 0; vert < GeometryInfo::vertices_per_cell; 
vert++)

{

 if("certain condition")

 {

 constraints_update.add_line(cell2->vertex_dof_index(vert,I));

 }

}

}


(Here constraints_update is an object of ConstraintMatrix).

 does not seem working because the solver eventually gives the error:
[...]


Well, that means that your matrix is probably not invertible (although the 
residual does get pretty small -- are you sure you don't just need more 
iterations?). This *may* be because of your constraints, but it may also be 
because of any number of other reasons. Have you tried this on a small 
problem, say a 2x2 or 3x3 mesh, to make sure it really is because of the 
constraints? For small problems, you can often figure out on a piece of paper 
what the matrix should be, and compare with what you get from your program.


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] Dealing with conflicting constraints without using VectorTools::interpolate_boundary_values()

2017-03-18 Thread Sogo Shiozawa
Hello, I am relatively new to deal.ii. I wonder if I can deal with 
conflicting constraints without using 
VectorTools::interpolate_boundary_values() 
.
 
The explanation here 
(https://www.dealii.org/8.4.1/doxygen/deal.II/group__constraints.html) 
only gives the cases using it.  The reason I don't want to use it is that I 
need to impose Dirichlet boundary conditions at points (at specific nodes). 
I do not believe VectorTools::interpolate_boundary_values() 

 can 
handle such a boundary condition.

I assign such a boundary condition at points by giving boundary values to 
std::map boundary_values directly, and it looks working well. However, 
for handling conflict between hanging node and boundary condition with 
ConstraintMatrix, just doing something like:

typename DoFHandler::active_cell_iterator cell = 
dof_handler.begin_active(),

 endc = 
dof_handler.end();  

for (; cell!=endc; ++cell)

{

for (unsigned int vert = 0; vert < 
GeometryInfo::vertices_per_cell; vert++)

{

 if ("certain condition") 

 {  

 constraints_update.add_line(cell2->vertex_dof_index(vert,I));

 }

}  

}


(Here constraints_update is an object of ConstraintMatrix).

 does not seem working because the solver eventually gives the error: 


Exception on processing:



An error occurred in line <828> of file 
 in 
function

void dealii::SolverGMRES::solve(const MATRIX&, VECTOR&, const 
VECTOR&, const PRECONDITIONER&) [with MATRIX = 
dealii::LinearAlgebraTrilinos::MPI::BlockSparseMatrix, PRECONDITIONER = 
BlockDiagonalPreconditioner, VECTOR = 
dealii::TrilinosWrappers::MPI::BlockVector]

The violated condition was:

false

The name and call sequence of the exception was:

SolverControl::NoConvergence (this->control().last_step(), 
this->control().last_value())

Additional Information:

Iterative method reported convergence failure in step 1000 with residual 
1.2908e-13



The simulation result looks reasonable until it gives the error, and so I 
think I correctly assigned the boundary condition at 
the points. The problem might be conflicting constraints are not handled 
appropriately in ConstraintMatrix. I hope my explanation is clear. It would 
be great if you could replay my question. 


Regards.

Sogo

-- 
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] Dealing with conflicting constraints

2016-07-05 Thread Wolfgang Bangerth

On 07/04/2016 08:52 AM, Ce Qin wrote:

Dear all,

I am now solving a problem using adaptive finite element method. The boundary
condition is Dirichlet condition. When the cells on boundary are locally
refined, the hanging node constraints are conflicting with inhomogeneous
constraints.

  In Constraints on degrees of freedom
,
 section
Dealing with conflicting constraints, it says:

If you want the hanging node constraints to win, then first build these
through the DoFTools::make_hanging_node_constraints()


 function.
Then interpolate the boundary values using
VectorTools::interpolate_boundary_values()


 into
the same ConstraintMatrix


 object.
If the latter function encounters a boundary node that already is
constrained, it will simply ignore the boundary values at this node and
leave the constraint untouched.


But in documentation of VectorTools::project_boundary_values_curl_conforming
,
it says:

If the ConstraintMatrix

|constraints|
 contained
values or other constraints before, the new ones are added or the old ones
overwritten, if a node of the boundary part to be used was already in the
list of constraints. This is handled by using inhomogeneous constraints.
Please note that when combining adaptive meshes and this kind of
constraints, the Dirichlet conditions should be set first, and then
completed by hanging node constraints, in order to make sure that the
discretization remains consistent. See the discussion on conflicting
constraints in the module on Constraints on degrees of freedom

.

I was totally confused. Which one is right?


It seems to me that both of these texts describe what the functions do. But 
they do different things. I think the first one does the correct thing whereas 
the second may not. Want to fix this in the code and the documentation?


Best
 W.

--

Wolfgang Bangerth   email:bange...@math.tamu.edu
www: http://www.math.tamu.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.