← Back to team overview

dolfin team mailing list archive

Re: Curl-curl demo

 

Even if core team doesn't like my demo, could some point me thats wrong with the following code. It's so simple and similar to the cpp version, that I completely don't understand why the results are different.

===============
from dolfin import *

mesh = UnitSphere(10)

PN = FunctionSpace(mesh, "Nedelec", 0)
P1 = VectorFunctionSpace(mesh, "CG", 1)

v0 = TestFunction(PN)
u0 = TrialFunction(PN)
v1 = TestFunction(P1)
u1 = TrialFunction(P1)

dBdt = Function(P1, ("0.0", "0.0", "1.0"))
zero = Function(P1, ("0.0", "0.0", "0.0"))
T = Function(PN)
J = Function(P1)

class DirichletBoundary(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary

bc = DirichletBC(P1, zero, DirichletBoundary())

# Eddy currents equation (using potential T)
Teqn = (dot(rot(v0), rot(u0))*dx, -dot(v0, dBdt)*dx)
Tproblem = VariationalProblem( Teqn[0], Teqn[1], bc)
T = Tproblem.solve()

# Current density equation
Jeqn = (dot(v1, u1)*dx, dot(v1, curl(T))*dx)
Jproblem = VariationalProblem( Jeqn[0], Jeqn[1])
J = Jproblem.solve()

plot(J)

interactive()
==============

cheers,
BArtek




Evan Lezar wrote:
That is true. And more examples are never a bad thing :)

On 3/31/09, Bartosz Sawicki <sawickib@xxxxxxxxxxxxx> wrote:
Yes, you are right, but your waveguide is eigenvalue problem and need
SLEPc to be installed. I think that it would be nice to have some basic
example which doesn't create extra requirements.
Just for dolfin beginners and for testing purposes.

BArtosz


Evan Lezar wrote:
Hi

The waveguide demo (pde/waveguide) uses the curl-curl formulation and
Nedelec elements for electromagnetic eigenvalue problems.  I am working on
a
couple of other demos for full wave electromagnetic problems.

Evan


2009/3/30 Bartosz Sawicki <sawickib@xxxxxxxxxxxxx>

I've written simple demo of curl-curl equation. It is based on
eddy-currents phenomena in low conducting materials. So far, in the demo
directory, there are no examples of this kind of PDE, where Nedelec
elements
are used.
If you found it useful, please consider placing it in the repository.

The patch which I'm sending, contains cpp and python code. Cpp works
fine,
but demo.py gives wrong results. I have no idea, whats wrong in the
python
code. Please, take a look, this is probably bug.

cheers,
BArtosz

_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev







Follow ups

References