Dear all;
To incorporate adaptive mesh refinement after each time steps in my ongoing work, I am trying to make follwoing small changes in step-26:
i. Initial condition
ii. A rectangular domain
iii. Homogeneous Neumann BC.
But I am getting some errors(negative values) in the obtained initial condition plot. The changes I have done in the following ways(also the code and initial plot is attached for your reference):
The initial values class is defined and called similar to step 23/31:
Template <int dim>
class InitialValues : public Function<dim>
{
public:
InitialValues()
: Function<dim>(1)
{}
virtual double value(const Point<dim> & p,
const unsigned int component = 0) const;
};
template <int dim>
double InitialValues<dim>::value(const Point<dim> &p,
const unsigned int component) const
{
Assert (component == 0, ExcInternalError());
const double radius = 0.2;
const double sigma = 0.1;
const double centerx = 0.0;
const double centery = 0.0;
const double dx = pow(p[0]-centerx,2);
const double dy = pow(p[1]-centery,2);
const double distance = sqrt(dx+dy);
double f_val = exp(-(dx+dy)/(2*pow(sigma,2)));
if ((distance-radius)<1e-25)
return f_val;
else
return 0;
}
VectorTools::project(dof_handler,
constraints,
QGauss<dim>(fe.degree + 1),
InitialValues<dim>(),
old_solution);
The grid is generation:
GridGenerator::hyper_cube(triangulation,-1,1);
Due to homogeneous Neumann BC, I have removed the boundary class and related functions.
I could not understand the reason for this, could someone please guide me in this regard?
Thanks & Regards
Pawan