On 8/3/23 05:01, Najwa Alshehri wrote:
The first scenario involves directly using the FeFieldFunction when my computed solution consists of a single component. In this case, I have successfully calculated the L2 and H1 norms of the error using the `integrate_difference` and `compute_global_error` functions. The calculations proceeded smoothly, and the execution speed was reasonable.

However, the second scenario involves using the FeFieldFunction when the computed solution consists of two components. My objective is to calculate the error for the first component only. To accomplish this, I employed the new VectorFunctionFromScalarFunctionObject class locally. Unfortunately, the computation of the L2 norm in this case was considerably slow and the H1 norm was very slow.

Given the current situation, I have two questions that I hope you can assist me with, as you have done in the past:

1. Regarding my specific project, is there an alternative method, other than the FeFieldFunction, to save the deserialized solution as a function and utilize it as the exact solution? It is crucial that the solution be saved in the first component of a vector with two components.

2. In a more general sense, how can I test this function to determine if the sluggishness is solely attributable to the FeFieldFunction? Additionally, I would like to verify whether the function is functioning correctly or not, to be able to send it in a pull request to the dealii git repository.

Najwa:
I don't know why the run time should be substantially slower for a system of two components than for a single scalar problem. That might be worth investigating. If you wanted to look into this, it would be useful to start with as small a program that shows the issue.

In general, FEFieldFunction is slow because it doesn't know where the function should be evaluated. If you give it a point, it first has to find the cell the point is in, and then compute the reference coordinates of that point, etc. You probably do this many times if you want to evaluate the solution on the quadrature points of a whole triangulation. This will never be fast

There are perhaps better ways to deal with the situation. For example, instead of doing the integration on the coarse mesh, you could take the coarse solution, interpolate it onto the fine mesh, and then do the integration over the fine mesh -- because there you can then just compute the values of both the coarse and fine solution at the quadrature points of the fine mesh using FEValues. This is fast, and the interpolation to the fine mesh should also be reasonably fast.

There are also faster but more specialized alternatives to FEFieldFunction. FEPointEvaluation is one option, though I don't know that class well enough.

Best
 W.

--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 [email protected]
                           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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/e79e6d07-c8ea-170a-abd9-8e0cedf6ca9d%40colostate.edu.

Reply via email to