<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Nov 9, 2016 at 8:14 AM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Wed, Nov 9, 2016 at 7:52 AM, Julian Andrej <span dir="ltr"><<a href="mailto:juan@tf.uni-kiel.de" target="_blank">juan@tf.uni-kiel.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I tried the example with different signs for the forcing, so this<br>
might be a mistake by me, yes. it doesn't change anything though. I<br>
also have to correct myself, the time for the callback in<br>
PetscDSAddBoundary changes correctly! Although u_t in all other<br>
callbacks seems to remain zero.<br>
<br>
I am out of ideas on my side though :)</blockquote><div><br></div></span><div>The bug is that the boundary conditions are not being properly enforced. I am fixing it now.</div><div>Thanks for the simple example demonstrating this. It made it much much easier to debug.</div></div></div></div></blockquote><div><br></div><div>I think this works. Let me know if you agree.</div><div><br></div><div>There is the business of u_t on the boundary, which is not handled right now. I am putting that</div><div>in, but the homogeneous values for that is still alright here.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>    Matt</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_2443855153346118514HOEnZb"><div class="m_2443855153346118514h5">
On Wed, Nov 9, 2016 at 2:33 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
> On Wed, Nov 9, 2016 at 12:32 AM, Julian Andrej <<a href="mailto:juan@tf.uni-kiel.de" target="_blank">juan@tf.uni-kiel.de</a>> wrote:<br>
>><br>
>> I tested a few other things and it turned out that the function added<br>
>> as a dirichlet boundary condition via PetscDSAddBoundary doesn't<br>
>> receive the time values correctly (PetscReal time is always 0.0).<br>
><br>
><br>
> I will check out your example and fix this. However, I wonder if there is a<br>
> bug in your implementation:<br>
><br>
> void f0_temp(PetscInt dim, PetscInt Nf, PetscInt NfAux,<br>
>           const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar<br>
> u[], const PetscScalar u_t[], const PetscScalar u_x[],<br>
>           const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar<br>
> a[], const PetscScalar a_t[], const PetscScalar a_x[],<br>
>           PetscReal t, const PetscReal x[], PetscScalar f0[])<br>
> {<br>
>   f0[0] = u_t[0] - 2.0;<br>
> }<br>
><br>
> I get<br>
><br>
>   du/dt - \Delta u = -2<br>
><br>
> so that if u = x^2 + y^2 + 2t, then<br>
><br>
>   2 - (2 + 2) = -2<br>
><br>
> so you would want u_t + 2.<br>
><br>
> If you give the Laplacian the opposite sign, this is an unstable<br>
> formulation.<br>
><br>
>   Thanks,<br>
><br>
>      Matt<br>
><br>
>><br>
>> I also see no effect adding DMTSSetIJacobianLocal vs. not setting the<br>
>> jacobian function. The analytic solution i used in my attached example<br>
>> is the same as in the src/ts/examples/tutorials/ex32<wbr>.c.<br>
>><br>
>> Am i doing anything obviously wrong here? My next step would be to try<br>
>> if assembling the matrices myself and writing a custom<br>
>> IFunction/IJacobian which assembles the different parts of the matrix<br>
>> like M and J for the stiff ODE with nontrivial mass matrix (see manual<br>
>> section of TS -> F = M u' - f) but i think this should be obsolete<br>
>> right?<br>
>><br>
>> Appreciate your help.<br>
>><br>
>> Regards<br>
>> Julian<br>
>><br>
>> On Mon, Nov 7, 2016 at 10:49 AM, Julian Andrej <<a href="mailto:juan@tf.uni-kiel.de" target="_blank">juan@tf.uni-kiel.de</a>><br>
>> wrote:<br>
>> > Hello,<br>
>> ><br>
>> > i'm using PetscFE in combination with SNES and a hand written backward<br>
>> > euler solver right now and like to hand that over to TS. I have been<br>
>> > fiddling quite a while getting TS to work with PetscFE and have<br>
>> > encountered a few unclarities.<br>
>> ><br>
>> > I have looked at examples which are outdated i guess<br>
>> > (src/ts/examples/tutorials/ex3<wbr>2.c) and i am confused on how i have to<br>
>> > formulate the discretization of the jacobian and the residual. It<br>
>> > seems obvious to use the DMTSSetIFunctionLocal and<br>
>> > DMTSSetIJacobianLocal functions because there are prepared wrappers<br>
>> > from DMPlexTSComputeIFunctionFEM and DMPlexTSComputeIJacobianFEM.<br>
>> ><br>
>> > I need a Mass matrix for my problem, is that formed from the function<br>
>> > space information or do i have to form it myself? Is there any working<br>
>> > example which uses PetscFE and TS to form the DMTSSetIFunctionLocal<br>
>> > and DMTSSetIJacobianLocal? (grepping the tree tells me "no"<br>
>> > unfortunately).<br>
>> ><br>
>> > Regards<br>
>> > Julian<br>
><br>
><br>
><br>
><br>
> --<br>
> What most experimenters take for granted before they begin their experiments<br>
> is infinitely more interesting than any results to which their experiments<br>
> lead.<br>
> -- Norbert Wiener<br>
</div></div></blockquote></div></div></div><div><div class="h5"><br><br clear="all"><div><br></div>-- <br><div class="m_2443855153346118514gmail_signature" data-smartmail="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>