[dune-pdelab] Initial conditions for instationary problems

conf86 at web.de conf86 at web.de
Thu Jun 4 11:45:29 CEST 2015


> > I have another question regarding the dune-course examples.
> > I'm trying to figure out where exactly the initial conditions for t=t_0 are set in example03. I see that in example03_Q1.hh there is a function calling the initial condition, but I don't really see the source.
> > Or is it not set at all and 0 by default for this example? If so, is there an example-code how to set it?
> 
> I only have example03_Q2.hh or example02_Q1.hh available (because I'm still in
> the train), but I guess the answer is as follows:

I'm sorry, I actually meant example03_Q2.hh.

> The dirichlet boundary conditions actually have to be consistent with the
> initial conditions at t=0.  So in the examples we usually use the same
> function for both: the stuff on *_bcextension.hh.  (BCExtension here means
> "the function describing the boundary condition, extended to the interior of
> the domain".)
> 
> The vector ok unknowns is then usually set to values interpolated from the
> initial conditions by code like this:
> 
>   typedef BCExtension<GV,Real> G;                               // boundary value + extension
>   G g(gv);
>   Dune::PDELab::interpolate(g,gfs,u);                           // interpolate coefficient vector
> 
> The second line instantiates a BCExtension object "g", which in the third line
> is interpoluted into the vector of unknowns "u", using the (grid) function
> space "gfs".

Thank you for your answer 

I think, I understand the second part.

But how exactly can I set the initial values in bcextension.hh?
My first guess would be something like this: 

 inline void evaluate(...){ 
 ....
 if (x[0]==0 && x[1]==0.5) y=2.0;
  }

for an initial value u0(x,y)=2 for x=0, y=0.5. Is this correct?

So I guess I don't have to specify between initial values and boundary values and I could also write (still for a circle)? 
 if (x[0]==0 && x[1]==1) y=1.0;




More information about the dune-pdelab mailing list