Dear all, I've implemented my boundary conditions weakly in my compressible stratified problem, but I get the following error now: How should I proceed to fix this? Will Traceback (most recent call last): File "compressible.py", line 181, in <module> solve(a == L, out) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving.py", line 120, in solve _solve_varproblem(*args, **kwargs) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving.py", line 145, in _solve_varproblem options_prefix=options_prefix) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/variational_solver.py", line 232, in __init__ super(LinearVariationalSolver, self).__init__(*args, **kwargs) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/variational_solver.py", line 118, in __init__ if ctx.is_mixed: File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving_utils.py", line 152, in is_mixed return self._jacs[-1]._M.sparsity.shape != (1, 1) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/function.py", line 248, in __getattr__ return getattr(self._data, name) AttributeError: 'CoordinatelessFunction' object has no attribute '_M' Exception AttributeError: "'LinearVariationalSolver' object has no attribute '_parameters'" in <bound method LinearVariationalSolver.__del__ of <firedrake.variational_solver.LinearVariationalSolver object at 0x7fcc08180090>> ignored
On 10/03/16 08:33, William Booker wrote:
Dear all,
I've implemented my boundary conditions weakly in my compressible stratified problem, but I get the following error now:
How should I proceed to fix this?
The problem is that you have defined your bilinear form "a" without using trial functions. Your code does: w = Function(W) u, r, p = split(w) v, s, q = TestFunctions(W) ... a = some_function(u, r, p, v, s, q) So when the linear solver comes to assemble it, thinking it's a matrix, you get an error. However, this is clearly an unfriendly error, and we should do a better job of catching it early. Cheers, Lawrence
Traceback (most recent call last): File "compressible.py", line 181, in <module> solve(a == L, out) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving.py", line 120, in solve _solve_varproblem(*args, **kwargs) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving.py", line 145, in _solve_varproblem options_prefix=options_prefix) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/variational_solver.py", line 232, in __init__ super(LinearVariationalSolver, self).__init__(*args, **kwargs) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/variational_solver.py", line 118, in __init__ if ctx.is_mixed: File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving_utils.py", line 152, in is_mixed return self._jacs[-1]._M.sparsity.shape != (1, 1) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/function.py", line 248, in __getattr__ return getattr(self._data, name) AttributeError: 'CoordinatelessFunction' object has no attribute '_M' Exception AttributeError: "'LinearVariationalSolver' object has no attribute '_parameters'" in <bound method LinearVariationalSolver.__del__ of <firedrake.variational_solver.LinearVariationalSolver object at 0x7fcc08180090>> ignored
I have #Define trial and test functions (u,r,p) = TrialFunctions(W) # Velocity, density, pressure respectively (dFdu_vec, dFdr, dFdp) = TestFunctions(W) # Test functions for velocity, density, pressure respectively defined earlier in the code. Is the problem that I have reused the name of my trial functions as a split(w) later on? Will ________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> Sent: 10 March 2016 09:47 To: firedrake@imperial.ac.uk Subject: Re: [firedrake] (no subject) On 10/03/16 08:33, William Booker wrote:
Dear all,
I've implemented my boundary conditions weakly in my compressible stratified problem, but I get the following error now:
How should I proceed to fix this?
The problem is that you have defined your bilinear form "a" without using trial functions. Your code does: w = Function(W) u, r, p = split(w) v, s, q = TestFunctions(W) ... a = some_function(u, r, p, v, s, q) So when the linear solver comes to assemble it, thinking it's a matrix, you get an error. However, this is clearly an unfriendly error, and we should do a better job of catching it early. Cheers, Lawrence
Traceback (most recent call last): File "compressible.py", line 181, in <module> solve(a == L, out) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving.py", line 120, in solve _solve_varproblem(*args, **kwargs) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving.py", line 145, in _solve_varproblem options_prefix=options_prefix) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/variational_solver.py", line 232, in __init__ super(LinearVariationalSolver, self).__init__(*args, **kwargs) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/variational_solver.py", line 118, in __init__ if ctx.is_mixed: File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving_utils.py", line 152, in is_mixed return self._jacs[-1]._M.sparsity.shape != (1, 1) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/function.py", line 248, in __getattr__ return getattr(self._data, name) AttributeError: 'CoordinatelessFunction' object has no attribute '_M' Exception AttributeError: "'LinearVariationalSolver' object has no attribute '_parameters'" in <bound method LinearVariationalSolver.__del__ of <firedrake.variational_solver.LinearVariationalSolver object at 0x7fcc08180090>> ignored
On 10/03/16 10:18, William Booker wrote:
I have
#Define trial and test functions (u,r,p) = TrialFunctions(W) # Velocity, density, pressure respectively (dFdu_vec, dFdr, dFdp) = TestFunctions(W) # Test functions for velocity, density, pressure respectively
defined earlier in the code. Is the problem that I have reused the name of my trial functions as a split(w) later on?
Yes, these are just names, so the later definition overwrites the earlier one. Lawrence
Okay I've commented out the erroneous lines. I now get the following error Will solve(a == L, out) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving.py", line 120, in solve _solve_varproblem(*args, **kwargs) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving.py", line 147, in _solve_varproblem solver.solve() File "<decorator-gen-277>", line 2, in solve File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/PyOP2-0.11.0_397_g9860f8d-py2.7-linux-x86_64.egg/pyop2/profiling.py", line 203, in wrapper return f(*args, **kwargs) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/variational_solver.py", line 173, in solve self.snes.solve(None, v) File "PETSc/SNES.pyx", line 520, in petsc4py.PETSc.SNES.solve (src/petsc4py.PETSc.c:169677) File "PETSc/petscsnes.pxi", line 253, in petsc4py.PETSc.SNES_Function (src/petsc4py.PETSc.c:33478) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/solving_utils.py", line 187, in form_function nest=problem._nest) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/assemble.py", line 68, in assemble inverse=inverse, nest=nest) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/assemble.py", line 101, in _assemble inverse=inverse) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/firedrake/ffc_interface.py", line 260, in compile_form fd = compute_form_data(form) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/ufl/algorithms/compute_form_data.py", line 331, in compute_form_data check_form_arity(preprocessed_form, self.original_form.arguments()) # Currently testing how fast this is File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/ufl/algorithms/check_arities.py", line 126, in check_form_arity check_integrand_arity(itg.integrand(), arguments) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/ufl/algorithms/check_arities.py", line 120, in check_integrand_arity args = map_expr_dag(rules, expr, compress=False) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/ufl/corealg/map_dag.py", line 68, in map_expr_dag r = function(v, *rops) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/ufl/corealg/multifunction.py", line 87, in __call__ return self._handlers[o._ufl_typecode_](o, *args) File "/home/cserv1_a/apps/install/firedrake/0.12.0/lib64/python2.7/site-packages/ufl/algorithms/check_arities.py", line 41, 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(FunctionSpace(Mesh(VectorElement('Q', quadrilateral, 1, dim=2), 1), MixedElement(VectorElement('DQ', quadrilateral, 0, dim=2), FiniteElement('DQ', quadrilateral, 0), FiniteElement('DQ', quadrilateral, 0))), 0, None), Argument(FunctionSpace(Mesh(VectorElement('Q', quadrilateral, 1, dim=2), 1), MixedElement(VectorElement('DQ', quadrilateral, 0, dim=2), FiniteElement('DQ', quadrilateral, 0), FiniteElement('DQ', quadrilateral, 0))), 1, None)) vs (Argument(FunctionSpace(Mesh(VectorElement('Q', quadrilateral, 1, dim=2), 1), MixedElement(VectorElement('DQ', quadrilateral, 0, dim=2), FiniteElement('DQ', quadrilateral, 0), FiniteElement('DQ', quadrilateral, 0))), 0, None),). ________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> Sent: 10 March 2016 10:27 To: firedrake@imperial.ac.uk Subject: Re: [firedrake] (no subject) On 10/03/16 10:18, William Booker wrote:
I have
#Define trial and test functions (u,r,p) = TrialFunctions(W) # Velocity, density, pressure respectively (dFdu_vec, dFdr, dFdp) = TestFunctions(W) # Test functions for velocity, density, pressure respectively
defined earlier in the code. Is the problem that I have reused the name of my trial functions as a split(w) later on?
Yes, these are just names, so the later definition overwrites the earlier one. Lawrence
On 10/03/16 10:42, William Booker wrote:
Okay I've commented out the erroneous lines. I now get the following error
Now the problem is that your definition of L contains both test and trial functions. I think this is the suspect line: L2 = ( dr_0*(((g*g)/(r_0*N))*(r_ - p_/c_0)*dFdu_vec[0] - dFdr*u[0]))*dx Lawrence
participants (2)
-
Lawrence Mitchell
-
William Booker