boundary conditions on a mixed function space
Dear Firedrakers, I've been trying to implement 0 dirichlet boundaries on a mixed function space that includes a vector space #Set up boundary conditions bcv_x = DirichletBC(W.sub(0).sub(0), Constant(0), method="geometric") bcv_z = DirichletBC(W.sub(0).sub(1), Constant(0), method="geometric") but I get back AttributeError: 'VectorFunctionSpace' object has no attribute 'sub' I thought we were meant to use sub twice to refer first to the function space component and then to the vector component. Also, would this be a correct approach for implementing no normal flow boundaries or is there a more appropriate method to use. Thanks Will
You need to provide a subdomain_id when creating the DirichletBC objects. For example: bcv_x = DirichletBC(W.sub(0).sub(0), Constant(0), 1, method="geometric") # note third argument! For a UnitSquareMesh, the subdomain_ids are: * 1: plane x == 0 * 2: plane x == 1 * 3: plane y == 0 * 4: plane y == 1 Regards, Miklos ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of William Booker <scwb@leeds.ac.uk> Sent: 09 December 2015 12:51 To: firedrake Subject: [firedrake] boundary conditions on a mixed function space Dear Firedrakers, I've been trying to implement 0 dirichlet boundaries on a mixed function space that includes a vector space #Set up boundary conditions bcv_x = DirichletBC(W.sub(0).sub(0), Constant(0), method="geometric") bcv_z = DirichletBC(W.sub(0).sub(1), Constant(0), method="geometric") but I get back AttributeError: 'VectorFunctionSpace' object has no attribute 'sub' I thought we were meant to use sub twice to refer first to the function space component and then to the vector component. Also, would this be a correct approach for implementing no normal flow boundaries or is there a more appropriate method to use. Thanks Will
Dear Miklos, I'm still getting the same error after adding in a domain id. File "compressible.py", line 30, in <module> bcv_x = DirichletBC(W.sub(0).sub(0), Constant(0), 1, method="geometric") File "/home/cserv1_a/apps/install/firedrake/0.11.0-328-gbf9dd55/lib64/python2.7/site-packages/firedrake/functionspace.py", line 812, in __getattr__ return getattr(self._fs, name) AttributeError: 'VectorFunctionSpace' object has no attribute 'sub' Will ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Homolya, Miklós <m.homolya14@imperial.ac.uk> Sent: 09 December 2015 13:21 To: firedrake Subject: Re: [firedrake] boundary conditions on a mixed function space You need to provide a subdomain_id when creating the DirichletBC objects. For example: bcv_x = DirichletBC(W.sub(0).sub(0), Constant(0), 1, method="geometric") # note third argument! For a UnitSquareMesh, the subdomain_ids are: * 1: plane x == 0 * 2: plane x == 1 * 3: plane y == 0 * 4: plane y == 1 Regards, Miklos ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of William Booker <scwb@leeds.ac.uk> Sent: 09 December 2015 12:51 To: firedrake Subject: [firedrake] boundary conditions on a mixed function space Dear Firedrakers, I've been trying to implement 0 dirichlet boundaries on a mixed function space that includes a vector space #Set up boundary conditions bcv_x = DirichletBC(W.sub(0).sub(0), Constant(0), method="geometric") bcv_z = DirichletBC(W.sub(0).sub(1), Constant(0), method="geometric") but I get back AttributeError: 'VectorFunctionSpace' object has no attribute 'sub' I thought we were meant to use sub twice to refer first to the function space component and then to the vector component. Also, would this be a correct approach for implementing no normal flow boundaries or is there a more appropriate method to use. Thanks Will
On 09/12/15 13:28, William Booker wrote:
bcv_x = DirichletBC(W.sub(0).sub(0), Constant(0), 1, method="geometric") File "/home/cserv1_a/apps/install/firedrake/0.11.0-328-gbf9dd55/lib64/python2.7/site-packages/firedrake/functionspace.py",
^^^^^^^^^^^^^^^^^^^ This is a very old Firedrake, in which the described feature did not exist. $ git show 0.11.0-328-gbf9dd55 commit bf9dd5549c4e5add9c6c86e1074d2949d31a58f1 Merge: b9cf0da 33d1104 Author: Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> Date: Wed Feb 18 11:32:58 2015 +0000 You'll need to upgrade. Cheers, Lawrence
participants (3)
-
Homolya, Miklós
-
Lawrence Mitchell
-
William Booker