Thanks Andrew an Julian for your helpful feedback. @Andrew: Yes, you were right that I had improperly defined the form. I have since fixed that and don't get an error. I am now working on getting the correct result. @Julian: This is a very interesting idea that you mention, which I admit I don't quite understand. What do you mean by shifting the boundary conditions out of my spectrum? When I use a matrix method, say spectral collocation on a chebyschev grid, I neglect the rows and columns corresponding to the end points since those are zero. Do you mean something should/can be done with the FEM as well? To make things a bit more complicated, I am only imposing zero Dirichlet BCs on the across channel velocity. If you had a reference you could point me to I will eagerly dig it up and try and better understand your concerns. I certainly want to do this right and avoid spurious eigenmodes if at all possible. Cheers, Francis ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 ________________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Julian Andrej [juan@tf.uni-kiel.de] Sent: Sunday, March 12, 2017 10:08 AM To: Firedrake Project Subject: Re: [firedrake] Problems with SLEPc You are computing Eigenvalues from a problem which involves Dirichlet boundary conditions but don't shift them out of your spectrum. So your if your Eigenvalues are around 0 real part, this leads to spurious Eigenmodes which arise from Dirichlet values on the boundary. On Sun, Mar 12, 2017 at 2:22 PM, Andrew McRae <A.T.T.McRae@bath.ac.uk> wrote:
"Adding expressions with non-matching form arguments {0} vs {1}."
It looks like you declared one of the forms incorrectly, e.g. used a trial function instead of a test function, or tried to add a form with a test function to a form with no test function, etc.
On 12 March 2017 at 12:49, Francis Poulin <fpoulin@uwaterloo.ca> wrote:
Hello,
I am trying to build on the QG SLEPc demo that I put together a while ago to solve for the linear instability of a 1D Shallow Water Jet. I've done this in the past using spectral methods and have had much success, but I often get spurious modes, which requires very high resolution to remove. I have been told by a reliable source that the FEM should be less prone to these spurious modes, which would be great.
I have a notebook and a python script at the following links:
https://github.com/francispoulin/firedrakeQG/blob/master/Linear%20Stability%...
https://github.com/francispoulin/firedrakeQG/blob/master/LSA_SW_Jet_Firedrak...
The error comes from the assemble part. I have done this previously with QG and SW in 2D and managed to get it working. This is only a 1D problem, so a little bit different, but should be easier. Unfortunately, when I do try it I get the following error, see below. I have tried different combinations but am not having any success.
One issue is that there are three variables: u, v, eta (height). I define the solution space to be V*V*V where V is a CG space. This is the major difference compared to what I tried before.
I am pretty sure that I am getting the syntax wrong here. Can anyone offer any advice?
Cheers, Francis
(firedrake) fpoulin@fpoulin-Gazelle:~/Research/2015-Ben_Storer/Firedrake$ python LSA_SW_Jet_Firedrake.py ('Ro = ', 0.25) ('Bu = ', 0.0004) ('profile = ', 'bickley') Traceback (most recent call last): File "LSA_SW_Jet_Firedrake.py", line 103, in <module> petsc_a = assemble(a, mat_type='aij', bcs=bc).M.handle File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/assemble.py", line 102, in assemble allocate_only=allocate_only) File "<decorator-gen-279>", line 2, in _assemble File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/utils.py", line 62, in wrapper return f(*args, **kwargs) File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/assemble.py", line 192, in _assemble kernels = tsfc_interface.compile_form(f, "form", parameters=form_compiler_parameters, inverse=inverse) File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/tsfc_interface.py", line 193, in compile_form number_map).kernels File "/home/fpoulin/software/firedrake/src/PyOP2/pyop2/caching.py", line 200, in __new__ obj = make_obj() File "/home/fpoulin/software/firedrake/src/PyOP2/pyop2/caching.py", line 190, in make_obj obj.__init__(*args, **kwargs) File "/home/fpoulin/software/firedrake/src/firedrake/firedrake/tsfc_interface.py", line 112, in __init__ tree = tsfc_compile_form(form, prefix=name, parameters=parameters) File "/home/fpoulin/software/firedrake/src/tsfc/tsfc/driver.py", line 44, in compile_form fd = ufl_utils.compute_form_data(form) File "/home/fpoulin/software/firedrake/src/tsfc/tsfc/ufl_utils.py", line 56, in compute_form_data do_estimate_degrees=do_estimate_degrees, File "/home/fpoulin/software/firedrake/src/ufl/ufl/algorithms/compute_form_data.py", line 387, in compute_form_data check_form_arity(preprocessed_form, self.original_form.arguments()) # Currently testing how fast this is File "/home/fpoulin/software/firedrake/src/ufl/ufl/algorithms/check_arities.py", line 152, in check_form_arity check_integrand_arity(itg.integrand(), arguments) File "/home/fpoulin/software/firedrake/src/ufl/ufl/algorithms/check_arities.py", line 145, in check_integrand_arity args = map_expr_dag(rules, expr, compress=False) File "/home/fpoulin/software/firedrake/src/ufl/ufl/corealg/map_dag.py", line 37, in map_expr_dag result, = map_expr_dags(function, [expression], compress=compress) File "/home/fpoulin/software/firedrake/src/ufl/ufl/corealg/map_dag.py", line 86, in map_expr_dags r = handlers[v._ufl_typecode_](v, *[vcache[u] for u in v.ufl_operands]) File "/home/fpoulin/software/firedrake/src/ufl/ufl/algorithms/check_arities.py", line 42, in sum raise ArityMismatch("Adding expressions with non-matching form arguments {0} vs {1}.".format(a, b)) ufl.algorithms.check_arities.ArityMismatch: Adding expressions with non-matching form arguments (Argument(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7f2a458c5290>, FiniteElement('Lagrange', interval, 2), name=None), Mesh(VectorElement(FiniteElement('Lagrange', interval, 1), dim=1), 1)), 0, None), Argument(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7f2a458c5290>, FiniteElement('Lagrange', interval, 2), name=None), Mesh(VectorElement(FiniteElement('Lagrange', interval, 1), dim=1), 1)), 1, None)) vs (Argument(WithGeometry(FunctionSpace(<firedrake.mesh.MeshTopology object at 0x7f2a458c5290>, FiniteElement('Lagrange', interval, 2), name=None), Mesh(VectorElement(FiniteElement('Lagrange', interval, 1), dim=1), 1)), 0, None),).
------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo
email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake