| 1 |
# Copyright (C) 2008 Evan Lezar |
| 2 |
# |
| 3 |
# This file is part of DOLFIN. |
| 4 |
# |
| 5 |
# DOLFIN is free software: you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU Lesser General Public License as published by |
| 7 |
# the Free Software Foundation, either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# DOLFIN is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU Lesser General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU Lesser General Public License |
| 16 |
# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
# |
| 18 |
# Forms for solving the transverse magnetic (TM) cutoff modes of a waveguide |
| 19 |
# |
| 20 |
# Compile this form with FFC: ffc -l dolfin Forms.form |
| 21 |
|
| 22 |
from ufl_legacy import * |
| 23 |
from ufl_legacy.log import set_level |
| 24 |
from ffc.compiler.compiler import compile |
| 25 |
|
| 26 |
# Set debug level |
| 27 |
set_level(20) |
| 28 |
|
| 29 |
# Reserved variables for forms |
| 30 |
(a, L, M) = (None, None, None) |
| 31 |
|
| 32 |
# Reserved variable for element |
| 33 |
element = None |
| 34 |
|
| 35 |
element = FiniteElement("Nedelec 1st kind H(curl)", "triangle", 2) |
| 36 |
|
| 37 |
v = TestFunction(element) |
| 38 |
u = TrialFunction(element) |
| 39 |
|
| 40 |
def curl_t(w): |
| 41 |
return Dx(w[1], 0) - Dx(w[0], 1) |
| 42 |
|
| 43 |
a = curl_t(v)*curl_t(u)*dx |
| 44 |
L = inner(v, u)*dx |
| 45 |
|
| 46 |
compile([a, L, M, element], "Forms", {'log_level': 20, 'format': 'dolfin', 'form_postfix': True, 'quadrature_order': 'auto', 'precision': '15', 'cpp optimize': False, 'split_implementation': False, 'cache_dir': None, 'output_dir': '.', 'representation': 'auto', 'optimize': True}, globals()) |