I am wondering for benchmark problems, is there a straight forward way to output relative errors? I understand dealii doesn’t have the method for that in the VectorTools namespace, so I am quite curious if there is any template to follow.
The function in VectorTools exists alright.
I think you should take a look at how the error is computed for some of the
other benchmarks in the benchmarks/ folders.
Thanks, but are you referring to VectorTools::L1_norm/L2_norm? Cause I thought those are just absolute error norm instead of relative ones with respect to exact solutions.
Right. They give you the enumerator of the ratio. You just need the
denominator in that case, which I would choose as the maximum of the solution.
Or how exactly do you define “relative error”?
For the denominator, I am thinking of the exact solution at each cell. (i.e. || u - u_e || / || u_e || )
For the denominator, I am thinking of the exact solution at each cell. (i.e.
u - u_e || / || u_e || )
The usual way to do this would actually be to divide by
which is something that you can easily get by writing it as
0 - u_e ||
which in turn you can get by calling VectorTools::integrate_difference() where
instead of the exact solution you pass Functions::ZeroFunction instead.
Somehow I produced an error that “expected primary expression before ‘)’ token”
My code for VectorTools::Integrate_difference is like the following,
I was trying to follow the syntax in the dealii tutorial step-64, but I am wondering if I have to fill in some additional expressions.
Thanks in advance,
I was trying to follow the syntax in the dealii tutorial step-64, but I am
wondering if I have to fill in some additional expressions.
You’ll have to show us more of the code and what line the error message
corresponds. It’s possible that
&comp_uh causes the problem that you’re
seeing, but I don’t know what
comp_uh actually is.
Once it compiles, you will get a run-time error because
creates a scalar function object, but you need one that has as many vector
components as the solution vector has components. That number should go into
Sorry for not making this clear, but I believe I have figured out the problem.
First for “comp_uh”, this is just a variable for the “ComponentSelectFunction” in this case, but it may not be necessary as normal “comp_u” (or comp_p for pressure) also works.
Second, indeed I need to fill the number of components in the parentheses, but it still produces the error of “error: reference to ‘ZeroFunction’ is ambiguous”, so instead of using Functions:ZeroFunction(), I just called ZeroFunction(), which somehow resolved the issue.
Again much appreciated of your help, thanks a lot.