-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finding edge dofs based on values in integration points #421
Comments
@mmalinen what do you think about this? |
I believe creating directly a square (N x N)-matrix, with N the count of edge element DOFs, would be the most natural approach. If one proceeds in a point-wise and coordinate-wise manner to obtain new rows, one could just stop adding new equations when N constraints have been obtained. The pattern of points where the matching has been done may then look unsymmetric, but I believe it shouldn't be a major problem ? |
Maybe I made a mistake earlier when creating NxN, but I had trouble finding the inverse. Test case: I get garbage out at the moment, If you see an obvious mistake, let me know. Thanks! |
To obtain a local interpolant having a guaranteed error estimate, I'd use a different approach and start by writing an additional integration loop in order to integrate the local mass matrix and evaluate suitable linear forms for the local interpolation. That is, I'd solve where |
This may be a little similar as |
Thanks for the info @mmalinen @raback ! Does this look about right to you https://github.com/ElmerCSC/elmerfem/blob/sr_decomposition/fem/src/modules/MagnetoDynamics/WhitneyAVSolver.F90#L1928 I am still getting garbage btw. |
Coming back to this. The previous seems to be due to face elements showing at the same time as body elements. But if we filter only the body elements, the field seems fine for debugging purposes. I am now showing here the vector potential (z component, as all others are 0) from which we calculate the magnetic flux density: This is the resulting magnetic flux density: This is clearly not what we expect. So it seems there is some issue with the algorithm to compute the magnetic flux density. Does the block at
look correct to you @raback? |
It seems that the DOFs (the content of the array Asloc after the first BLOCK) are computed correctly. I verified this with some simple source fields which should be contained in the FE space so that an accurate FE representation should be possible. These tests included the case of constant fields and the field However, the loop
makes valgrind to say "Invalid read of size 4". I commented this out, since I checked only the first BLOCK which doesn't need |
It seems that your code at the moment (4c822dc) supposes the variables |
I was going through old issues and looked into this. My recommendation would be to use the Elemental routinies here since the initial field may be more accurate directly on IP points. Does not really make sense to go through the nodal points. Also the resulting fields may be saved directly as IP fields and let the code take care of the interpolation. Unfortunately I do not be able to get the projection to work any better than you. For my eye it should work. The initial vector potential looks good as an IP field. But it fitted version and the resulting rotor does not. |
Assuming we know edge element dofs we can calculate values at integration points:
$a_\mathrm{ip}=R_\mathrm{w} a_\mathrm{dofs}$
or
Explicitly in code:
a_ip(1:3) = MATMUL(a_dofs(nd-np), wbasis(nd-np, 1:3))
Assuming we know values at integration points, we need to do the reverse, solve the linear system:
$a_\mathrm{dofs} = R_\mathrm{w}^{-1} a_\mathrm{ip}$
However,$R_\mathrm{w}$ is not a square matrix, it is
This system is under determined. Though, we can assemble all the integration points to the same matrix, then we have a matrix size
So to solve this, one can do
We thus need a subroutine$(R^T R_\mathrm{w})^{-1} R^T$ based on curl basis and values of variable at integration points.
SUBROUTINE InvWbasis(Wbasis, a_ip)
that can generateThe text was updated successfully, but these errors were encountered: