Always thanks for you. 
I have read step-30, and now i understand how it is done,
I was trying to implement on my problem as like....


Frist, refine_mesh function , I have designated which cell to be refined, 

    template <int dim>

    void

    *StokesProblem<dim>::refine_mesh (**const unsigned int 
refinement_cycle, double max_shear)*

    //AMR based on Cellwise Shear-rate

    {

        

        GridRefinement::refine_and_coarsen_fixed_number (triangulation,

                                                         
cellwise_shear_rate,

                                                         0.1, 0.0); *//Here 
I marked what cells to be refined *

        

        set_anisotropic_flags();*//and I called additional function to set 
anisotropic direction.  *

        

        SolutionTransfer<dim,BlockVector<double>> 
solution_transfer(dof_handler);

        //Prepare Solution Transfer for Block vector solution

        

        *//This one is problematic*

        triangulation.prepare_coarsening_and_refinement ();

        

        solution_transfer.prepare_for_coarsening_and_refinement(solution);

    

        triangulation.execute_coarsening_and_refinement ();

        

        dof_handler.distribute_dofs (fe);

        DoFRenumbering::Cuthill_McKee (dof_handler);

      

        

        

        std::vector<unsigned int> block_component (dim+1,0);

        block_component[dim] = 1;

        DoFRenumbering::component_wise (dof_handler, block_component);

      

       

     

        triangulation.execute_coarsening_and_refinement ();

     

        std::vector<types::global_dof_index> dofs_per_block (2);

        DoFTools::count_dofs_per_block (dof_handler, dofs_per_block, 
block_component);

        const unsigned int n_u = dofs_per_block[0], n_p = dofs_per_block[1];

        

        

        // save new space for previous solution

        previous_solution.reinit (2);

        previous_solution.block(0).reinit (n_u);

        previous_solution.block(1).reinit (n_p);

        previous_solution.collect_sizes ();

        

        

        //Transfer solution

        solution_transfer.interpolate(solution, previous_solution);

        

    }

    


After that, I am trying to setting one direction to be refined. cut_x, 
cut_y, or cut_xy 


template <int dim>

    void

    *StokesProblem<dim>::set_anisotropic_flags ()*

    {

        typename DoFHandler<dim>::active_cell_iterator 
cell=dof_handler.begin_active()

        ,endc=dof_handler.end();

        

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

        {

            if (cell->refine_flag_set())

            {

                *//For a just test case, I am trying to cut in one 
direction ,x y  *

               //std::cout <<" Now just pass"<<std::endl;

              Case1 // cell->set_refine_flag(RefinementCase<dim>::cut_x);

              Case2 //  cell->set_refine_flag(RefinementCase<dim>::cut_y);

                 cell->set_refine_flag(RefinementCase<dim>::cut_xy); *//For 
this case, the cell will be just cut as isotropy refinement *

            }

        }

        

    

    }


Among three cases, the code is one working with "
cell->set_refine_flag(RefinementCase<dim>::cut_xy);" 


When I try to refine my cells only in x or y direction, I just receives 
error as follow...


cell->set_refine_flag(RefinementCase<dim>::cut_x);

cell->set_refine_flag(RefinementCase<dim>::cut_y);


especially this error has occurred when code is running the line " 
triangulation.prepare_coarsening_and_refinement 
() "... in refinement function.. 


Do you have any ideas what might be a possible problem ? 



*An error occurred in line <12146> of file 
</Users/kimjaekwang/dealii-8.4.1/source/grid/tria.cc> in function*

*    void dealii::(anonymous 
namespace)::possibly_refine_unrefined_island(const typename 
Triangulation<dim, spacedim>::cell_iterator &, const bool) [dim = 2, 
spacedim = 2]*

*The violated condition was: *

*    cell->refine_flag_set() == false*

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

*    ExcInternalError()*

*Additional Information: *

*This exception -- which is used in many places in the library -- usually 
indicates that some condition which the author of the code thought must be 
satisfied at a certain point in an algorithm, is not fulfilled. An example 
would be that the first part of an algorithm sorts elements of an array in 
ascending order, and a second part of the algorithm later encounters an an 
element that is not larger than the previous one.*


*There is usually not very much you can do if you encounter such an 
exception since it indicates an error in deal.II, not in your own program. 
Try to come up with the smallest possible program that still demonstrates 
the error and contact the deal.II mailing lists with it to obtain help.*




2017년 3월 29일 수요일 오후 10시 20분 24초 UTC-5, Wolfgang Bangerth 님의 말:
>
> On 03/29/2017 06:37 PM, Jaekwang Kim wrote: 
> > 
> > I am sorry but I am not that good at c++, so I was bit confused how to 
> use 
> > this function. 
> > 
> > I have just set flag cell like 
> > 
> > *cell->set_refine_flag ();* 
> > 
> > 
> > Reading the document pages, you linked, I can understand that I should 
> put 
> > some argument inside parenthesis. 
> > I think I should cut my cell in y-direciton (thought that it is  y in 
> local 
> > cell direction, it is why), so my input should be.... 
> > 
> > cell->set_refine_flag (RefinementCase::cut_y); 
> > 
> > 
> > but I get error as... 
> > 
> > *//Users/kimjaekwang/Programs/dealii/examples/step-1/step-1.cc:79:42: 
> > /**/error: /* 
> > 
> > */      'RefinementCase' is not a class, namespace, or enumeration/* 
> > 
> > /                  cell->set_refine_flag (RefinementCase::cut_y);/ 
> > 
> > */                                         ^/* 
> > 
> > 
> *//Users/kimjaekwang/Programs/dealii/include/deal.II/base/geometry_info.h:293:7:
>  
>
> > /**/note: /* 
> > 
> > /      'RefinementCase' declared here/ 
> > 
> > /class RefinementCase : public RefinementPossibilities<dim>/ 
> > 
>
>
> You should read through step-30 to see how this is done. 
> 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.

Reply via email to