Skip to content
Snippets Groups Projects
Commit 488e7054 authored by David Seus's avatar David Seus
Browse files

add domainPatch._calc_dof_indices_of_interfaces(self)

parent 54a7c58b
No related branches found
No related tags found
No related merge requests found
...@@ -137,6 +137,9 @@ class DomainPatch(df.SubDomain): ...@@ -137,6 +137,9 @@ class DomainPatch(df.SubDomain):
# timestep size, tau in the paper # timestep size, tau in the paper
self.timestep = timestep self.timestep = timestep
### Class variables set by methods ### 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() # measures are set by self._init_measures()
self.iteration_number = 0 self.iteration_number = 0
self.dx = None self.dx = None
...@@ -154,10 +157,24 @@ class DomainPatch(df.SubDomain): ...@@ -154,10 +157,24 @@ class DomainPatch(df.SubDomain):
self._init_dof_and_vertex_maps() self._init_dof_and_vertex_maps()
self._init_boundary_markers() self._init_boundary_markers()
self._init_measures() self._init_measures()
self._calc_dof_indices_of_interfaces()
# END constructor # END constructor
#### PUBLIC METHODS #### 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]: 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""" """ return the governing form ant right hand side as a dictionary"""
# define measures # define measures
...@@ -238,6 +255,7 @@ class DomainPatch(df.SubDomain): ...@@ -238,6 +255,7 @@ class DomainPatch(df.SubDomain):
self.vertex2dof self.vertex2dof
""" """
mesh_data = self.mesh.data() mesh_data = self.mesh.data()
# local to parent vertex index map
self.parent_mesh_index = mesh_data.array('parent_vertex_indices',0) self.parent_mesh_index = mesh_data.array('parent_vertex_indices',0)
if self.isRichards: if self.isRichards:
self.dof2vertex = {# self.dof2vertex = {#
...@@ -281,6 +299,25 @@ class DomainPatch(df.SubDomain): ...@@ -281,6 +299,25 @@ class DomainPatch(df.SubDomain):
# measure over the interfaces # measure over the interfaces
self.ds = df.Measure('ds', domain = self.mesh, subdomain_data = self.boundary_marker) 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 is_Richards
# END OF CLASS DomainPatch # END OF CLASS DomainPatch
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment