Hello,
It seems I am unable to find a function similar to VectorTools::interpolate for FE_Nedelec finite elements. The existing implementation of this functions gives the following run-time error:
An error occurred in line <556> of file </home/john/dealii-9.1.1/include/deal.II
/numerics/vector_tools.templates.h> in function
void dealii::VectorTools::interpolate(const dealii::Mapping<dim, spacedim>&,
const DoFHandlerType<dim, spacedim>&, const dealii::Function<spacedim, typename
VectorType::value_type>&, VectorType&, const dealii::ComponentMask&) [with int
dim = 3; int spacedim = 3; VectorType = dealii::Vector<double>; DoFHandlerType =
dealii::DoFHandler; typename VectorType::value_type = double]
The violated condition was:
dof_handler.get_fe().n_components() == function.n_components
Additional information:
Dimension 3 not equal to 1.
Looks like VectorTools::interpolate does not like the vector-valued finite elements. Could you please point me in the right direction?
Best,
John
Dear Simon,
Thank you for your reply. Your suggestion definitely works. I used functions that output one component when I was interpolating scalar potentials. It works well.
However, the FE_Nedelec is different. It implements edge elements. They are vector-based. That is, functions are represented by a superposition of vector-valued shape functions:
\vec{A} = \sum u_i vec{N}_i .
Therefore, the output of the "value" method in “class CustomFunction : public Function” must be vector-valued. Three components in a three-dimensional space. Otherwise, there is no point in interpolation.
This kind of vectorial approximations is a bread-and-butter topic in magnetics. See, for example, equation (7) in:
https://ieeexplore.ieee.org/document/497322
In short, the source, i.e the current vector potential, must be projected on the space spanned by the vector-valued shape functions. Otherwise, the simulation is numerically unstable. The last, from my experience, is definitely true.
Best,
John
--
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 a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/wG3j4yD1rpw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/6d051c9e-8840-4e5d-8021-f8007a1dc543n%40googlegroups.com.
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 dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/CAH3L9AVtN%3Dtaqi2YiTjfoyfhxo-%2B9XnNzpBqNXSHqk5wX4iUtQ%40mail.gmail.com.
--
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 dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/567f6646-df23-8c97-f210-87fd5a74e3ae%40colostate.edu.
Dear Konrad,
Thank you for your help! I have recently modified the step-3 tutorial program to save FE_Nedelec<2> fe(0) shape function into *.csv files. It is attached to this message. The result of this program is not what I would expect it to be. I have also attached a pdf file which compares my expectations (marked as “Expectations” in the pdf file) with the results of the modified step-3 program (marked as “Reality” in the pdf file). My expectations are based on the literature I have. My question is: why the shape functions of FE_Nedelec<2> fe(0) differ from my expectations? I guess my expectations are all wrong. I would also appreciate if you will share with me a reference to a paper or a book, so I can extend my modest library.
Thanks!
John
P.S. I have sent you an e-mail as you have requested. Could you please check your spam folder?
--
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 dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/348bd8f9-0891-42e5-b150-c3723eacb84bn%40googlegroups.com.
<FE_Nedelec.pdf><step-3.cc>
Dear Jean-Paul,
Thanks! It is indeed
a trap.
John
Dear Konrad,
I do not understand when a geometry gets complicated. Is a toroid inside a sphere, both centred at the origin, a complicated geometry? To start with, I will use a relatively simple mesh. I will not use local refinement, only global. I can do without refinement as well, i.e. making the mesh in gmsh.
Yes, I would like to know more about orientations issues on complicated geometries. Could please tell me about it? I would very much prefer to use FE_Nedelec without hierarchical shape functions. The first order 3D FE_Nedelec will do nicely provided the orientation issues will be irrelevant to the mesh.
John
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/b82d4595-8508-4201-98d7-c554019f6574n%40googlegroups.com.
Dear Jean-Paul,
Thank you for sharing this information with me!
Could you please check if I understand it correctly:
If I use the FE_NedelecSZ<3> fe(0) on a mesh imported from gmsh without any refinement in deal.ii, then the FE_NedelecSZ<3> fe(0) finite elements will not be hierarchical (as there is no refinement) . This will allow me to escape the face/edge orientation issues. In this case, the FE_NedelecSZ<3> fe(0) will be as FE_Nedelec<0> fe(0) minus the issues with the orientation of the faces and edges.
Is this correct? If it is, then I switch to FE_NedelecSZ<3> fe(0).
I have attached an example of a mesh I am thinking about. There are three figures: inner part of the mesh, outer sphere (infinity), and an adaptor (it just keeps the mesh cells nicely aliened) . I think it is “edge-elements friendly”…
John
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/A86FD959-B364-460E-B77C-CA24133C4F38%40gmail.com.
curl(nu*curl(A)) - grad(div(A)) = J
which you then have to write as a system of PDEs. Note, this can only be the same as
curl(nu*curl(A)) = J
if J is a curl itself.
If you do not want to impose conditions on the divergence then you have two options:
1.) You use sigma = div(A) as an auxiliary variable and impose natural boundary conditions (i.e., the ones that you get through integration by parts) on A*n and nu*curl(A)xn, where n is the outward unit normal. This means that sigma is a 0-form and A is a 1-form -> sigma is then discretized (for example) by FE_Q(n+1) and A by FE_Nedelec(n)
System:
(A1) sigma + div(A) = 0
(B1) grad(sigma) + curl(nu*curl(A)) = J
For the weak form you multiply (A1) with a FE_Q test function and
integrate the second summand by parts. Secondly, you multiply (B1)
with a Nedelec test function and also integrate the second summand
by parts. You will see your natural boundary conditions pop up.
2.) You use sigma = nu*curl(A) as an auxiliary variable and impose essential boundary conditions on A*n and nu*curl(A)xn, where n is the outward unit normal. This means that sigma is interpreted as a 1-form and A is a 2-form -> sigma is then discretized (for example) by FE_Nedelec(n) and A by FE_RaviartThomas(n)
System:
(A2) (1/nu)*sigma - curl(A) = 0
(B2) curl(sigma) - grad(div(A)) = J
For the weak form you multiply (A2) with a Nedelec test function
and integrate the second summand by parts. Secondly, you multiply
(B2)
with a Raviart-Thomas test function and also integrate the second
summand by parts. You will NOT see your natural boundary
conditions pop up since conditions on A*n and nu*curl(A)xn are
essential in this case. You need to enforce them on the function
spaces directly. In deal.ii you do so by using project_boundary_values_curl_conforming_l2
or project_boundary_values_div_conforming
Note that the additional boundary conditions make the system
invertible and if J is a curl it will turn out that div(A)=0.
There is a field in mathematics that is called finite element exterior calculus (FEEC) that answers the question of stability when solving such problems. See this book. I guess Chapters 4, 5 and 6 are most interesting for you.
I do not understand when a geometry gets complicated. Is a toroid inside a sphere, both centred at the origin, a complicated geometry? To start with, I will use a relatively simple mesh. I will not use local refinement, only global. I can do without refinement as well, i.e. making the mesh in gmsh.
Yes, I would like to know more about orientations issues on complicated geometries. Could please tell me about it? I would very much prefer to use FE_Nedelec without hierarchical shape functions. The first order 3D FE_Nedelec will do nicely provided the orientation issues will be irrelevant to the mesh.
Hope that helps.
Best,