Hello Daniel,
Thanks for your reply and help. I am attaching a part of the code herewith.
Thanks and regards,
Anup.
On Tuesday, November 29, 2016 at 9:41:19 AM UTC-6, Daniel Arndt wrote:
>
> Anup,
>
> I am trying to implement the periodic boundary condition for a nonlinear
>> parabolic equation (scalar).
>> I have considered a *parallelepiped *as shown in the attached pdf. I
>> want to impose periodic
>> BC at x=0 and x=w surfaces. I have used an offset vector as appearing in
>> the piece of code
>> below, which I formed based on my understanding from the documentation
>> (it is tangential to the
>> surface x = w). Could you please tell
>> me if it is the correct expression. I think the problem is in this vector
>> only, because when I reduce the
>> angle theta to zero, it works. Boundary x =0 and x=w are numbered as 1
>> and 11, respectively.
>> I also tried with the offset vector : Tensor<1, dim>(0., 0., -
>> w*tan(theta))
>> Any suggestion and help would be appreciated.
>>
>> constraints_eta1.clear();
>> std::vector<GridTools::PeriodicFacePair<typename
>> DoFHandler<dim>::cell_iterator> > periodicity_vector1;
>> GridTools::collect_periodic_faces(dof_handler_eta, 1, 11, 0,
>> periodicity_vector1,
>> Tensor<1, dim>(0., 0.,
>> w*tan(theta)));
>>
>> DoFTools::make_periodicity_constraints<DoFHandler<dim>
>> >(periodicity_vector1, constraints_eta1);
>> constraints_eta1.close();
>>
> That looks and sounds correct if the vertices of the bounding
> parallelepiped have the coordinates
> (0|0|0), (w|0|tan(theta)*w), (0|h|0), (w|h|tan(theta)*w), (0|0|L),
> (w|0|L+tan(theta)*w), (0|h|L), (w|h|L+tan(theta)*w)
>
> Can you confirm that the coarse cells have the correct boundary
> indicators? Would you have a minimal code?
>
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.
template <int dim>
void Solid<dim>::run()
{
make_grid();
system_setup();
}
////////////////////////////////////////////
template <int dim>
Point<dim> grid_y_transform (const Point<dim> &pt_in)
{
const double &x = pt_in[0];
const double &z = pt_in[2];
const double z_upper = 45.0 + 0.5413861341550015*x;
const double z_lower = 0.0 + 0.5413861341550015*x;
const double theta = z/45.0;
const double y_transform = (1-theta)*z_lower + theta*z_upper;
Point<dim> pt_out = pt_in;
pt_out[2] = y_transform;
return pt_out;
}
///////////////////////////////////////////////////////////////
template <int dim>
void Solid<dim>::make_grid()
{
std::vector< unsigned int > repetitions(dim, parameters.elements_per_edge);
repetitions[dim-3] = parameters.elements_per_width;
if (dim == 3)
repetitions[dim-2] = 1;
const Point<dim> bottom_left = (dim == 3 ? Point<dim>(0.0, -parameters.thickness, 0.0) : Point<dim>(0.0, 0.0));
const Point<dim> top_right = (dim == 3 ? Point<dim>(parameters.width, parameters.thickness,
parameters.length) :
Point<dim>(parameters.width, parameters.length));
GridGenerator::subdivided_hyper_rectangle(triangulation,
repetitions,
bottom_left,
top_right);
const double tol_boundary = 1e-6;
typename Triangulation<dim>::active_cell_iterator cell =
triangulation.begin_active(), endc = triangulation.end();
for (; cell != endc; ++cell)
for (unsigned int face = 0;
face < GeometryInfo<dim>::faces_per_cell; ++face)
if (cell->face(face)->at_boundary() == true)
{
if (std::abs(cell->face(face)->center()[0] - 0.0) < tol_boundary)
cell->face(face)->set_boundary_id(1);
else if (std::abs(cell->face(face)->center()[0] - parameters.width) < tol_boundary)
cell->face(face)->set_boundary_id(11);
}
GridTools::transform(&grid_y_transform<dim>, triangulation);
GridTools::scale(parameters.scale, triangulation);
}
/////////////////////////////////////////////////////////////////////
template <int dim>
void Solid<dim>::system_setup()
{
dof_handler_eta.distribute_dofs (fe_eta);
const unsigned int n_dofs_eta = dof_handler_eta.n_dofs();
constraints_eta1.clear();
std::vector<GridTools::PeriodicFacePair<typename DoFHandler<dim>::cell_iterator> > periodicity_vector1;
GridTools::collect_periodic_faces(dof_handler_eta, 1, 11, 0, periodicity_vector1,
Tensor<1, dim>(0., 0., 0.5413861341550015*parameters.width*1e-9));
DoFTools::make_periodicity_constraints<DoFHandler<dim> >(periodicity_vector1, constraints_eta1);
constraints_eta1.close();
}