Hi I want to ask a question about the calculation of this absolute function
If I define the following:
f = Coefficient(V)
a = abs(f) * dx
then what is actually happening?
In FEM, any function defined in the space V can be expressed using the basis functions: f_h = \sum_{j=1}^N\psi_jf_j. My concerning is that when I use high-order polynomial as basis functions, the basis function can also be negative somewhere so I wonder does it do \int \vert\sum_{j=1}^N\psi_jf_j\vert {\rm d}x or \int \sum_{j=1}^N\psi_j\vert f_j\vert {\rm d}x?
Also if do something more complicated like
f = Coefficient(V)
g = Coefficient(V)
v = TestFunction(V)
a = abs(f+g.dx(0))* v * dx
But how does it calculate the integral exactly? Using Trapazoidal rule of something like that? You know when you have some high-order basis function, then in some part the basis function is negative itself, also in the case you just showed, the function inside the absolute sign might be negative somewhere, so how is the integral computed?
Let DOLFINx decide what quadrature rule to use (based on analysis of the form)
The absolute value of a coefficient at a point in the domain might have negative values in some of the basis functions, yes. However, one should sum all of them (multiplied by the coefficient) prior to calling the abs function.
I’m wondering if it’s possible to use the abs (absolute value) function outside the UFL file?
I’m trying to implement some high-dimensional problems using kronproduct.
For example, if I need the mass matrix \int\psi_i\psi_j\ {\rm d}\pmb{x} in 4D, I can define the bilinear form
a = u*v*dx
in 2D and assemble 2 mass matrices in 2D, then compute the kronproduct of them, which give me the mass matrix in 4D
But somehow I need to project the term that involve the absolute values, for example: |f+g|, then I usually write my UFL(in dolfinx it is just python file) file like this
a = abs(f+g) * v * dx
In the high-dimensional case, such forms aren’t explicitly defined, so I might need to construct them manually. Given this context, do you have any suggestions on how to handle the absolute value in this setting? I’d really appreciate any guidance—thanks so much!
No I don’t think it is possible in my case.
The main reason is that my underlying function is very complicated, it is something like this:
|g+a_1\partial_{x_1}f+a_2\partial_{x_2}f+a_3\partial_{x_3}f+a_4\partial_{x_4}f|
where both f and g are 4D functions, if I want to construct the form without absolute sign, I can construct the terms one by one using kronproduct, and then add them up, but there is absolute sign, I can not do that anymore since the absolute values need to be taken inside the integral.