### Use of curl_t(N_i) for electromagnetic waveguide analysis

158

views

0

Hi, all,

I am trying to re-do the electromagnetic waveguide analysis example on Page 629-642 in Chapter 34 in the FEniCS book, but I encountered an error message using the existing codes in the book, here is the first a few lines of my program:

I am trying to re-do the electromagnetic waveguide analysis example on Page 629-642 in Chapter 34 in the FEniCS book, but I encountered an error message using the existing codes in the book, here is the first a few lines of my program:

```
from dolfin import *
import numpy as np
#the mesh used for the rectangular hollow guides
a = 1.0
b = 0.5
#create a rectangular mesh with origin(0,0) extending to (a,b) with 8 edges along the
#long side and 4 elements along the short side
mesh = RectangleMesh(Point(0.0, 0.0), Point(a, b), 8, 4)
print("Plotting a RectangleMesh")
plot(mesh, title="Rectangle")
#define the orders of the function spaces for vector and nodal basis functions
vector_order = 2
nodal_order = 3
# define mixed element, mesh.ufl_cell() == "triangle"
vector_element = FiniteElement("Nedelec 1st kind H(curl)", mesh.ufl_cell(), vector_order)
nodal_element = FiniteElement("Lagrange", mesh.ufl_cell(), nodal_order)
mixed_element = MixedElement([vector_element, nodal_element])
combined_space = FunctionSpace(mesh, mixed_element)
#define the test and trial functions from the combined space
#here N_v and N_u are Nedelec basis functions and L_v and L_u are Lagrange basis functions
(N_i, Li) = TestFunctions(combined_space)
(N_j, Lj) = TrialFunctions(combined_space)
#specify the relative permittivity and permeability
e_r = 1.0
u_r = 1.0
#define the forms (matrix elements) for cutoff analysis w.r.t. the basis functions
s_tt_ij = 1.0/u_r*inner(curl_t(N_i), curl_t(N_j))
```

However, the last line gives me the following error message:

`NameError: name 'curl_t' is not defined`

The meaning of the error is quite obvious, but why does this happen? Is this function deprecated for the current version? Then which function should I use now?

Any help is appreciated. Thanks in advance.

Community: FEniCS Project

### 1 Answer

0

```
def curl_t(w):
return Dx(w[1], 0) - Dx(w[0], 1)
```

From here:

https://github.com/FEniCS/dolfin/blob/master/demo/undocumented/waveguide/python/demo_waveguide.py

Please login to add an answer/comment or follow this question.

Jianan