The solution of one of the physical fields does not change

67 views
Skip to first unread message

Tiny Y

unread,
Jun 1, 2024, 11:24:09 PMJun 1
to deal.II User Group

Hi everyone

The solution for one of my physical field models is not changing in any way. I made a 2D model before and was able to calculate the results, but when I switched to a 3D model I had the above problem, my mesh was generated with GridGenerator::cylinder_shell(triangulation,1000,r1,r2,160,10), the boundary conditions were applied at r1=0.05 with a temperature of -53°C The boundary condition imposed at r2=0.45 is 0°C, and the initial condition is 0°C. However the temperature is constant at all moments except time=0 when it is zero图片1.jpg

I tried changing the K_TT and the RHS corresponding to the temperature and the output remains the same.

 Below is my code for making the grid:

图片2.png

When I changed the part in the red circle to 1e-6 the temperature produced a small (1e-4 or so) change .

This looks like the boundary conditions are interpolated directly into the solution, is this a mistake I made in the AffineConstraints class? Or is it something else?

Thank you for your great kindness and generosity.

Some of my functions are as follows,

========================================

template <int dim>
void
FracturePhaseFieldProblem<dim>::set_bc ()
{
   std::map<unsigned int, double> boundary_values;
  std::vector<bool> component_mask(dim+2, false);
  BoundaryRing<dim> bc_ring(time);
  dealii::Functions::ZeroFunction<dim> f_zero(dim+2);
  if (test_case == TestCase::ring)  //cylinder
    {
      component_mask[0] = true;
      component_mask[1] = true;
      component_mask[2] = true;
      component_mask[dim] = true;
      component_mask[dim+1] = true;//temperature element
      VectorTools::interpolate_boundary_values(dof_handler, 2,  /*inner*/
                                               f_zero,constraints_update, component_mask);
      component_mask[0] = false;
      component_mask[1] = false;
      component_mask[2] = false;
      component_mask[dim] = false;
      component_mask[dim+1] = true;//temperature element
      VectorTools::interpolate_boundary_values(dof_handler, 1,  /*outer*/
                                                bc_ring, constraints_update, component_mask);
      component_mask[0] = false;
      component_mask[1] = false;
      component_mask[2] = true;
      component_mask[dim] = false;
      component_mask[dim+1] = false;//temperature element
      VectorTools::interpolate_boundary_values(dof_handler, 3,  //upper
                                                f_zero, constraints_update, component_mask);
      component_mask[0] = false;
      component_mask[1] = false;
      component_mask[2] = false;
      component_mask[dim] = true;
      component_mask[dim+1] = false;//temperature element
      VectorTools::interpolate_boundary_values(dof_handler, 4,  //underground
                                                f_zero, constraints_update, component_mask);
    }
}
=========================================

template <int dim>    
double
BoundaryRing<dim>::value (const Point<dim>  &p,
                                  const unsigned int component) const
{
  Assert (component < this->n_components,
          ExcIndexRange (component, 0, this->n_components));


  double dis_step_per_timestep = -1.0;
  double pressure_per_z = 1.0e4;
  double tempeture_per_z = -0.06;
  double beta_e=1e-5;  

 if (true)    //
  {
      if (component == dim + 1)  
      {
        return ( ( std::abs(std::sqrt(std::pow(p(1), 2.0) + std::pow(p(0), 2.0) ) - 0.05 ) <= 1.0e-4)
               ?
               beta_e*(-5-p(2)*0.06): 0 );beta_e*(-5-p(2)*0.06);//
      }
      else
      return 0;
  }

}
=============================================
template <int dim>
double FracturePhaseFieldProblem<dim>::three_field_iterator()  
{

    //set_initial_bc(time);
    //constraints_hanging_nodes.distribute(solution);

    //assemble_nl_residual();
    constraints_update.set_zero(system_pde_residual); //AffineConstraints

    LA::MPI::BlockVector old_solution_relevant(partition, partition_relevant, mpi_com);  
    old_solution_relevant = old_solution;


    set_bc();
    assemble_system();
        //constraints_update.set_zero(system_pde_residual);//------------------------------
    unsigned int no_linear_iterations = solve();
   
    pcout << "\t" << no_linear_iterations << std::endl << std::flush;
    return 0;
   
}

Wolfgang Bangerth

unread,
Jun 10, 2024, 6:56:36 PMJun 10
to dea...@googlegroups.com


On 6/1/24 21:24, Tiny Y wrote:
> The solution for one of my physical field models is not changing in any
> way. I made a 2D model before and was able to calculate the results, but
> when I switched to a 3D model I had the above problem, my mesh was
> generated with
> GridGenerator::cylinder_shell(triangulation,1000,r1,r2,160,10), the
> boundary conditions were applied at r1=0.05 with a temperature of -53°C
> The boundary condition imposed at r2=0.45 is 0°C, and the initial
> condition is 0°C. However the temperature is constant at all moments
> except time=0 when it is zero。图片1.jpg

Tiny Y:
I don't really know what it is that is going wrong without seeing the
whole code, but I think that what you are doing in your function that
sets boundary ids is to ask whether for a given face center (x,y) you have
x^2 + y^2 < 10^{-4}*r
Are you sure that there are face centers that satisfy this criterion?
Similarly for the other conditions in the following else if blocks. This
is where I would start to investigate.

Separately, you could write that condition much simpler as
if (cell->face(face_number)->center().norm() < 1e-4 * r)

Best
W.

Tiny Y

unread,
Jun 12, 2024, 9:28:18 PMJun 12
to deal.II User Group
Thank you for your reply.
My problem seems to be that constraints not only constraint the boundaries but also constrain the interior.
Maybe I should take one field at a time to debug.

Best 
Y.

Wolfgang Bangerth

unread,
Jun 12, 2024, 11:03:00 PMJun 12
to dea...@googlegroups.com
On 6/12/24 19:28, Tiny Y wrote:
> Maybe I should take one field at a time to debug.

Yes, making it simple -- that's always a good strategy for debugging!

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Reply all
Reply to author
Forward
0 new messages