1. If I make delta larger(left: delta=0.05), or refine the mesh much finer (right:"triangulation.refine_global (9);" while the original is "triangulation.refine_global (7);") then I can get the results without too much oscillations:

6.jpg

Yes, that is not surprising. You get oscillations if the mesh is not fine enough to resolve the features of the solution. This is the same as if you do a Fourier series of a function with a steep gradient: the sum of the first few Fourier terms is oscillatory unless you include sin(n*x) and cos(n*x) with n large enough for the sines and cosines to have a period on the same order as the width of the gradient of the original function.

You can therefore avoid the oscillations if either (i) you make the steep gradient spread out over a larger length scale, (ii) increase n.


So, my questions are:
1.If I need to get

4.JPG


in every time step, which means that phi_x and phi_y are updated in every time step, and the information of phi_x and phi_y are calculated from "phi" by using function: "get_function_gradients".

And I don't know the exact value of phi and grad_phi in every time step. So how can I remove  oscillations?

I don't understand this. If you don't know what grad phi is, how do you want to compute atan2(phi_y,phi_x) and from that F? If you don't know what phi is, you also can't compute grad phi via a finite different approximation.

It doesn't matter whether you compute the gradient exactly or via a FDM approximation *conceptually*, but it will almost certainly be *more accurate* to use the exact derivative with get_function_gradients().


If I can use FDM above in every time step, how to get real coordinates of grid nodes, then get the real coordinates of adjacent nodes, and get the values of phi_up, phi_down, phi_left, phi_right?

We generally do this by using FEValues::get_function_values() and FEValues::quadrature_point(), which when initialized on a cell gives you the values and locations of a function evaluated at quadrature points. If you want the values at the center of a cell, you can always use QMidpoint as your quadrature formula.

But, I will mention, that this approach only works if you have a uniform mesh aligned with the x- and y-axes. That's not a very general case. I would try to use a method that works for any geometry.


2. If this method can not go, how can I remove  oscillations? Maybe use DG to describe F? and add some interior penalty?

The problem is generic: If the function has a sharp gradient, then a projection onto *any* finite dimensional space will yield oscillations *unless* you can resolve the width of the gradient with your mesh. There is simply nothing very much you do about this with linear operations.

In your case, you can at least prevent the propagation of oscillations to neighboring cells if you project onto a DG space. You do not need penalty terms since the equation you want to solve is local and has no derivatives. Just do the projection locally.

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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to