" No, it isn't. What you are plotting is the *interpolated* version of the function. As a consequence... ...this should not be a surprise unless you can convince that the *interpolated* function should be the same in both cases. This is a question about the function f(x,y) you use: Is it in the function space you are using or not? "
Makes totally sense! The function I interpolate using an FE_Q<1> element is f(x,y) = 0.12x + 0.002x^4 + sqrt(y), 3.0<{x,y}<4.0 Lets call the FE function f^h(x,y) which lives in the space H^1, hence it lives in a different space than f(x,y). Clearly, df^h(x,y) / dx and df^h(x,y) / dy are discontinuous and I project them using global smoothing as implemented in VectorTools::project. , hence df^h(x,y) / dx and df^h(x,y) / dy live again in H^1 and I can differentiate them again to calculate the "second derivatives" of f^h(x,y). The mixed second partial derivatives of f(x,y) are zero per design, which is perfectly captured by f^h(x,y) in the unrotated grid with only 9 degrees of freedom (refining once globally a GridGenerator::general_cell). After rotating the grid as shown in my question, the mixed second partial derivatives of f^h(x,y) are no longer zero, although f^h(x,y) and the smoothed first derivatives show good agreement with the analytical counterparts. I think this is because the (lines of the) cells are not aligned with the global coordinate system and things get mixed up due to the interpolation. If the cells are aligned with the global coordinate system, the decoupling of x and y can be captured on a coarse grid Does this argumentation make sense? I would have to refine the rotated grid roughly seven times to approximate this decoupling accurately. Unfortunately, I can refine the grid globally at most twice. Do you have an idea how to capture the above decoupling also at the rotated grid better -- maybe by generating the grid differently? The input to my grid are four points which represent the minimal bounding box of a set of points in 2d and the grid should roughly represent this box. Thank you very much for your input, Math Am Fr., 9. Juni 2023 um 01:20 Uhr schrieb Wolfgang Bangerth < bange...@colostate.edu>: > > > In both screenshots, the function > > f(x,y) over the respective triangulations is plotted. > > No, it isn't. What you are plotting is the *interpolated* version of the > function. As a consequence... > > > > As en example, see the point with the white cross -- f(x,y) at the > rotated > > triangulation is 2.81005 and f(x,y) at the original triangulation is > 2.8047. > > f(x,y) at the support points is correct and matches the value returned > from > > the function object (Function::value) passed to the interpolate call. > > I am surprised about the differences since I expected that rotating the > > triangulation has no effect on f(x,y), if evaluated at the same point. > > ...this should not be a surprise unless you can convince that the > *interpolated* function should be the same in both cases. This is a > question > about the function f(x,y) you use: Is it in the function space you are > using > or not? > > > > My second question pertains to the gradient, which is a Tensor<1,2>. > > I need to compute the derivatives of f(x,y) in x-and y-direction. > > Say, I call get_function_gradients(res,f(x,y)) based on the rotated > > triangulation, > > stores 'res' the derivatives wrt x and y, > > or do I have to make a transformation? > > It returns the derivatives with regards to the global coordinate system > within > which the triangulation lives, not the reference coordinate system of the > cells (or the coordinate system in which the triangulation lived before it > was > rotated -- the triangulation does not retain a memory of its rotation). > > > > df(x,y) / dy = 0 per design, which is correct in the original > triangulation, > > but not in the rotated triangulation. > > Do I miss something here? > > Like before, what you need to think about is whether the *interpolated* > version of f(x,y) should have a zero derivative. > > Best > W. > > -- > ------------------------------------------------------------------------ > Wolfgang Bangerth email: bange...@colostate.edu > www: http://www.math.colostate.edu/~bangerth/ > > > -- > 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 dealii+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/dealii/34518363-1cb9-2912-5a5e-1e6a5fcdb00c%40colostate.edu > . > -- 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 dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/CA%2BwBsdPoP-E_hNi75Y%3DCnWf_d9Y%3DnzawfQwrG4pYrwgqFjBkwg%40mail.gmail.com.