Could we calculate the errors in H1 norm for Poisson example in tutorial?

11 views
Skip to first unread message

Thomas

unread,
Sep 10, 2017, 10:14:48 AM9/10/17
to mofem Group
Could we calculate the errors in H1 norm for Poisson example? For example, global error or local error in H1 norm. Thank you.

Lukasz Kaczmraczyk

unread,
Sep 10, 2017, 11:10:05 AM9/10/17
to mofem...@googlegroups.com
Hello Thomas,

In Poisson tutorial, http://mofem.eng.gla.ac.uk/mofem/html/poisson_tut1.html, error is calculated in H1 norm. Calculation of error is implemented in file http://mofem.eng.gla.ac.uk/mofem/html/_poisson_operators_8hpp-example.html, see operator OpError, in particular http://mofem.eng.gla.ac.uk/mofem/html/struct_poisson_example_1_1_op_error.html.

You can notice there in method PoissonExample::OpError::iNtegrate(), that both error on functions values and functions gradients is integrated.


      for(int gg = 0;gg!=nbIntegrationPts;gg++) {
       
double alpha = vol*t_w;
       
// evalue exact value
       
double exact_u = uValue(t_coords(NX),t_coords(NY),t_coords(NZ));
       
// evalue exact hradient
        t_exact_grad
= gValue(t_coords(NX),t_coords(NY),t_coords(NZ));
       
// calculate gradient errro
        t_error_grad
(i) = t_grad(i)-t_exact_grad(i);
       
// error
       
double error = pow(t_u-exact_u,2)+t_error_grad(i)*t_error_grad(i);
       
// iterate over base functions
        data
.getFieldData()[0] += alpha*error;
       
++t_w;      // move to next integration point
       
++t_u;      // next value of function at integration point
       
++t_grad;   // next gradient at integration point
       
++t_coords; // next coordinate at integration point
     
}

Regards,
Lukasz

Reply all
Reply to author
Forward
0 new messages