From 488e70543aded971386444b333b8dbf5a987e07c Mon Sep 17 00:00:00 2001
From: David Seus <david.seus@ians.uni-stuttgart.de>
Date: Wed, 20 Mar 2019 14:23:31 +0100
Subject: [PATCH] add domainPatch._calc_dof_indices_of_interfaces(self)
---
domainPatch.py | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/domainPatch.py b/domainPatch.py
index 9324468..0a5b016 100644
--- a/domainPatch.py
+++ b/domainPatch.py
@@ -137,6 +137,9 @@ class DomainPatch(df.SubDomain):
# timestep size, tau in the paper
self.timestep = timestep
### Class variables set by methods
+ # dictionary holding the dof indices corresponding to an interface of
+ # given interface. see self._calc_dof_indices_of_interfaces()
+ self.dof_indices_of_interface = dict()
# measures are set by self._init_measures()
self.iteration_number = 0
self.dx = None
@@ -154,10 +157,24 @@ class DomainPatch(df.SubDomain):
self._init_dof_and_vertex_maps()
self._init_boundary_markers()
self._init_measures()
+ self._calc_dof_indices_of_interfaces()
# END constructor
#### PUBLIC METHODS
+ def write_pressure_to_interfaces(self):
+ """ save the interface values of self.pressure to all neighbouring interfaces"""
+ if self.isRichards:
+ for ind in has_interface:
+ interface[ind].write_dofs(from_function = self.pressure, #
+ interface_dofs = dofs_on_interface1,#
+ dof_to_vert_map = self.dof2vertex['wetting'],#
+ local_to_parent_vertex_map = self.parent_mesh_index,#
+ phase = 'wetting',#
+ subdomain_ind = self.subdomain_index)
+ else:
+
+
def govering_problem(self, phase: str, iter_num: int = 0) -> tp.Dict[str, fl.Form]:
""" return the governing form ant right hand side as a dictionary"""
# define measures
@@ -238,6 +255,7 @@ class DomainPatch(df.SubDomain):
self.vertex2dof
"""
mesh_data = self.mesh.data()
+ # local to parent vertex index map
self.parent_mesh_index = mesh_data.array('parent_vertex_indices',0)
if self.isRichards:
self.dof2vertex = {#
@@ -281,6 +299,25 @@ class DomainPatch(df.SubDomain):
# measure over the interfaces
self.ds = df.Measure('ds', domain = self.mesh, subdomain_data = self.boundary_marker)
+ def _calc_dof_indices_of_interfaces(self):
+ """ calculate dof indices """
+ V = self.function_space
+ marker = self.boundary_marker
+ for ind in has_interface:
+ self._dof_indices_of_interface.update(#
+ {ind: dict()}
+ )
+ if self.isRichards:
+ self._dof_indices_of_interface[ind].update(#
+ {'wetting': self.interface[ind].dofs_on_interface(V['wetting'], marker, ind)}
+ )
+ else:
+ self._dof_indices_of_interface[ind].update(#
+ {'wetting': self.interface[ind].dofs_on_interface(V['wetting'], marker, ind),#
+ 'nonwetting': self.interface[ind].dofs_on_interface(V['nonwetting'], marker, ind)}
+ )
+
+
# END is_Richards
# END OF CLASS DomainPatch
--
GitLab