Dear all, I tried to build a mixed space with periodic bc on two of the subspaces: meshbase = RectangleMesh(Nx, Ny, Lx, Ly, quadrilateral=True) mesh = ExtrudedMesh(meshbase, Nz, Delta_z) horiz_elt = FiniteElement("DG", quadrilateral, 0) DG1 = FunctionSpace(mesh, horiz_elt) meshbase = PeriodicRectangleMesh(Nx, Ny, Lx, Ly, quadrilateral=True) mesh = ExtrudedMesh(meshbase, Nz, Delta_z) horiz_elt = FiniteElement("DG", quadrilateral, 0) DG2 = FunctionSpace(mesh, horiz_elt) DG3 = FunctionSpace(mesh, horiz_elt) W = DG1 * DG2 * DG3 but got an error message (see below). Is there a way to set periodic bc on two of the three subspaces? Henrik Traceback (most recent call last): File "twophase.py", line 43, in <module> W = DG1 * DG2 * DG3 File "/home/hb111949/Code/firedrake/firedrake/functionspace.py", line 536, in __mul__ return MixedFunctionSpace((self, other)) File "/home/hb111949/.local/lib/python2.7/site-packages/PyOP2-0.11.0_425_g64db689-py2.7-linux-x86_64.egg/pyop2/caching.py", line 161, in __new__ obj = make_obj() File "/home/hb111949/.local/lib/python2.7/site-packages/PyOP2-0.11.0_425_g64db689-py2.7-linux-x86_64.egg/pyop2/caching.py", line 142, in make_obj obj.__init__(*args, **kwargs) File "/home/hb111949/Code/firedrake/firedrake/functionspace.py", line 742, in __init__ self._ufl_element = ufl.MixedElement(*[fs.ufl_element() for fs in self._spaces]) File "/home/hb111949/.local/lib/python2.7/site-packages/ufl/finiteelement/mixedelement.py", line 57, in __init__ domains = tuple(sorted(set(chain(*[element.domains() for element in elements])))) File "/home/hb111949/.local/lib/python2.7/site-packages/ufl/domain.py", line 216, in __lt__ return self.hash_data() < other.hash_data() File "/home/hb111949/.local/lib/python2.7/site-packages/ufl/exproperators.py", line 55, in _lt return LT(left, right) File "/home/hb111949/.local/lib/python2.7/site-packages/ufl/conditional.py", line 144, in __init__ BinaryCondition.__init__(self, "<", left, right) File "/home/hb111949/.local/lib/python2.7/site-packages/ufl/conditional.py", line 72, in __init__ "Expecting scalar arguments.") File "/home/hb111949/.local/lib/python2.7/site-packages/ufl/assertions.py", line 37, in ufl_assert if not condition: error(*message) File "/home/hb111949/.local/lib/python2.7/site-packages/ufl/log.py", line 151, in error raise self._exception_type(self._format_raw(*message)) ufl.log.UFLException: Expecting scalar arguments. -- Dipl.-Math. Henrik Büsing Institute for Applied Geophysics and Geothermal Energy E.ON Energy Research Center RWTH Aachen University ------------------------------------------------------ Mathieustr. 10 | Tel +49 (0)241 80 49907 52074 Aachen, Germany | Fax +49 (0)241 80 49889 ------------------------------------------------------ http://www.eonerc.rwth-aachen.de/GGE hbuesing@eonerc.rwth-aachen.de ------------------------------------------------------
Hi Henrik, On 14/12/15 11:31, Buesing, Henrik wrote:
Dear all,
I tried to build a mixed space with periodic bc on two of the subspaces:
meshbase = RectangleMesh(Nx, Ny, Lx, Ly, quadrilateral=True)
mesh = ExtrudedMesh(meshbase, Nz, Delta_z)
horiz_elt = FiniteElement("DG", quadrilateral, 0)
DG1 = FunctionSpace(mesh, horiz_elt)
This makes a non-periodic mesh and a DG1 function space on it.
meshbase = PeriodicRectangleMesh(Nx, Ny, Lx, Ly, quadrilateral=True)
mesh = ExtrudedMesh(meshbase, Nz, Delta_z)
horiz_elt = FiniteElement("DG", quadrilateral, 0)
DG2 = FunctionSpace(mesh, horiz_elt)
DG3 = FunctionSpace(mesh, horiz_elt)
Now you make a /different/ periodic mesh and build two more function spaces on it.
W = DG1 * DG2 * DG3
This builds a mixed space for the full 3 field system. But DG1 and (DG2/DG3) are defined on different meshes, so there is no coupling between them.
but got an error message (see below).
Is there a way to set periodic bc on two of the three subspaces?
I think there's a little confusion going on as to how periodic bcs work. We implement periodic boundary conditions by make a /topologically/ connected mesh, but using a discontinuous coordinate field. So the PeriodicRectangleMesh is /topologically/ a torus but "looks like" just a normal rectangle because the coordinates are associated with the cells, not the mesh vertices. So the way we implement periodic boundary conditions is that the dof associated with the periodic mesh entities is actually the same dof (rather than somehow being mapped). Note that since all your fields are DG all of the dofs are associated with cells. What you've attempted to do above is definitely unsupported: we don't know how to build the couplings between the two unrelated meshes. Can you describe what you're attempting to achieve? Do you want two of the fields to have periodic bcs and the third one to have somehow a non-periodic source/sink bc or something similar? Cheers, Lawrence
Can you describe what you're attempting to achieve? Do you want two of the fields to have periodic bcs and the third one to have somehow a non- periodic source/sink bc or something similar?
Yes, I would like to have periodic bcs for two of the fields. On one of the fields I want to prescribe Dirichlet bc. Henrik
On 14/12/15 11:56, Buesing, Henrik wrote:
Can you describe what you're attempting to achieve? Do you want two of the fields to have periodic bcs and the third one to have somehow a non- periodic source/sink bc or something similar?
Yes, I would like to have periodic bcs for two of the fields. On one of the fields I want to prescribe Dirichlet bc.
OK, so you can't do this strongly, because there's no "edge" in the domain. You could do one of two things: 1. manually identify the dofs in the non-periodic field to kill You would do something like: from firedrake import * from firedrake import utils class MyDirichletBC(DirichletBC): @utils.cached_property def nodes(self): # Return a numpy array that identifies the appropriate # indices. 2. The other option is to apply these terms weakly somehow. They will then turn into dS integrals. To select the "edge", you could interpolate a Heaviside function into a DG0 space which jumps at the edge. Then you could use the jump of this Function to introduce the appropriate weak "internal" boundary. Lawrence
On 14/12/15 11:56, Buesing, Henrik wrote:
Can you describe what you're attempting to achieve? Do you want two of the fields to have periodic bcs and the third one to have somehow a non- periodic source/sink bc or something similar?
Yes, I would like to have periodic bcs for two of the fields. On one of the fields I want to prescribe Dirichlet bc.
OK, so you can't do this strongly, because there's no "edge" in the domain.
You could do one of two things:
1. manually identify the dofs in the non-periodic field to kill
2. The other option is to apply these terms weakly somehow. They will then turn into dS integrals.
Could I also calculate just the individual problems and then do a Picard iteration over these, instead of doing Newton over the full mixed space? Is there an example for 2)? Thank you! Henrik
participants (2)
- 
                
                Buesing, Henrik
- 
                
                Lawrence Mitchell