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;
}