diff --git a/LDDsimulation/domainPatch.py b/LDDsimulation/domainPatch.py index bb9974426c93073626115d9523a1515ac2f6c449..8d66b564807a7dd0af207a6c581986b08f8c00ae 100644 --- a/LDDsimulation/domainPatch.py +++ b/LDDsimulation/domainPatch.py @@ -715,8 +715,41 @@ class DomainPatch(df.SubDomain): def _calc_interface_has_common_dof_indices(self): """ populate dictionary self._interface_has_common_dof_indices - Determin for each interface in self.has_interface the dof indices + Determin for each interface in self.has_interface the dof indices that + also belong to another interface and store them in the dictionary + self._interface_has_common_dof_indices + This method populates the dictionary + self._interface_has_common_dof_indices """ + for interf_ind, interf_dofs in self._dof_indices_of_interface.items(): + # initialise bool numpy arry for the search. + if self.isRichards: + is_part_of_neighbour_interface_w = np.zeros(interf_dofs['wetting'].size, dtype=bool) + else: + is_part_of_neighbour_interface_w = np.zeros(interf_dofs['wetting'].size, dtype=bool) + is_part_of_neighbour_interface_nw = np.zeros(interf_dofs['nonwetting'].size, dtype=bool) + + for other_interf_ind, other_interf_dofs in self._dof_indices_of_interface.items(): + if other_interf_ind is not interf_ind: + if self.isRichards: + is_part_of_neighbour_interface_w += np.isin(interf_dofs['wetting'], other_interf_dofs['wetting'], assume_unique=True) + else: + is_part_of_neighbour_interface_w += np.isin(interf_dofs['wetting'], other_interf_dofs['wetting'], assume_unique=True) + is_part_of_neighbour_interface_nw += np.isin(interf_dofs['nonwetting'], other_interf_dofs['nonwetting'], assume_unique=True) + # this carries a numpyarray of the indices which belong to other + # interfaces, too + self._interface_has_common_dof_indices.update({interf_ind: dict()}) + if self.isRichards: + self._interface_has_common_dof_indices[interf_ind].update( + {'wetting': interf_dofs['wetting'][is_part_of_neighbour_interface_w]} + ) + else: + self._interface_has_common_dof_indices[interf_ind].update( + {'wetting': interf_dofs['wetting'][is_part_of_neighbour_interface_w]}, + {'nonwetting': interf_dofs['nonwetting'][is_part_of_neighbour_interface_nw]} + ) + + # END OF CLASS DomainPatch