Closed santiagobadia closed 4 years ago
I guess there is some kind of FE restriction method and it cannot be written automatically... I will look for it, please let me know if it does exist and which is its name
The noise
fe function is aligned with the volume mesh. Before to integrate it on the boudnary, you have to restrict it, with bnoise = restrict(noise,btrian)
or perhaps bnoise = restrict(btrian,nose)
I don't remember exactly. Then, use bnoise
to compute the integrals.
I see that in all the tests, the right hand side seems to be an analytical function. Have you ever tried to include a term defined in terms of a FE function, e.g.,
function B_Ω(y)
v, q = y
inner(v,noise)
end
This term does not work even at the bulk.
Using bnoise = restrict(btrian,nose)
does work. Now I wanted to create a linear form on the RHS with inner(v,noise)
. Since you do not need to define explictly the restriction for the trial and test spaces, e.g.
function B_∂Ω(y)
v, q = y
+ (γ/h) * inner(v,ud) - inner(∇(v), outer(nb,ud_cf)) + inner(q*nb,ud)
# + inner(v,noise)
end
or
function A_∂Ω(y,x)
u, p = x
v, q = y
(γ/h) * inner(v,u) - inner(outer(nb,v), ∇(u)) - inner(∇(v), outer(nb,u)) + inner(v, p*nb) + inner(q*nb,u)
end
it seems more consistent not to explicitly require to restrict boundary terms and just write
function B_∂Ω(y)
v, q = y
+ inner(v,noise)
end
Which is the expected usage you have in mind?
In any case, let us consider the bulk term first...
The term in the bulk should work...unless there is a bug.
For the boundaries, the current usage is to restrict all the cell fields that are captured by the function B_∂Ω(y)
. I don't see any easy way of doing these extra restrictions internally in a general way. It can be done, but it would require to attach a lot of metadata to the cell fields in order to decide to restrict or not in function of this metadata...
For the boundary, is this the expected usage?
gdofs = interpolate_values(V,u)
gh = FEFunction(V,gdofs[1],gdofs[2])
bgh = restrict(btrian,gh)
b_∂Ω(v) = inner(v,bgh)
It does not work. I want to create a FEFunction that I can integrate for boundary terms.
I am about to be ready with the new version for single-field problems.
It makes more sense to wait and see if the problem persist or not in the new version.
Ok, so I guess that the usage is correct but there is a bug... We can wait
These problems should be fixed with v0.7.0. Closing issue.
Hi @fverdugo
Sorry for raising more problems... but I am trying to integrate a boundary term and it does not work.
If you do the same for interior no problem. I have also considered to replace the integration by another FE function that results from solving the problem, and the problem persists.
The idea is to include a noise term in the projector we are working on. There are probably other ways to do it, but I have just considered a normal distribution for all dofs and create a FE function this way. Surely, I can create a random_fe_function(fespace) method but this is not the point of this discussion...