diff --git a/domainPatch.py b/domainPatch.py
index de36a41f76bcacedebc044bc4bf140dd99f8398d..1abfc25388a6af5b3429b207855f3ee23dd3097b 100644
--- a/domainPatch.py
+++ b/domainPatch.py
@@ -962,24 +962,22 @@ class Interface(BoundaryPart):
self.gli_term_prev[subdomain_ind][phase].update({parent[d2v[dof_index]]: from_function.vector()[dof_index]})
print("have written previous gl interface values\n", self.gli_term_prev[subdomain_ind][phase])
- def read_dofs(self, to_function: df.Function, #
+ def read_pressure_dofs(self, to_function: df.Function, #
interface_dofs: np.array,#
dof_to_vert_map: np.array,#
local_to_parent_vertex_map: np.array,#
phase: str,#
subdomain_ind: int,#
- pressure: bool = False,#
- gl: bool = False,#
+ # pressure: bool = False,#
+ # gl: bool = False,#
previous_iter: bool = False,#
) -> None:
- """ read dofs off self.pressure_values and overwrite the dofs of from_function
+ """ read dofs off self.pressure_values and overwrite the dofs of to_function
with indices interface_dofs
Read the degrees of freedom of one of the dictionaries of the interface
self.pressure_values[subdomain_ind][phase], (if pressure == True)
self.pressure_values_prev[subdomain_ind][phase], (if previous_iter == True)
- self.gli_term[subdomain_ind][phase], (if gl == True)
- self.gli_term_prev[subdomain_ind][phase] (if previous_iter == True)
and overwrite the dofs of the function to_function with indices
interface_dofs, i.e. update the interface dofs of the function.
.
@@ -996,10 +994,6 @@ class Interface(BoundaryPart):
'nonwetting' and determins
the dict to be read of.
subdomain_ind #type: int subdomain index
- pressure #type: bool determins wether pressure
- values are being read or not
- gl #type: bool determins wether gl
- values are being read or not
previous_iter #type: bool determins wether a previous
iterate is being read or not
"""
@@ -1009,36 +1003,77 @@ class Interface(BoundaryPart):
parent = local_to_parent_vertex_map
d2v = dof_to_vert_map
- if pressure:
- if not previous_iter:
- for dof_index in interface_dofs:
- # from_function.vector() is orderd by dof and not by vertex numbering of the mesh.
- # parent needs a mesh vertex index of the submesh, therefore d2v is needed.
- to_function.vector()[dof_index] = self.pressure_values[subdomain_ind][phase][parent[d2v[dof_index]]]
- print("read pressure interface values\n", self.pressure_values[subdomain_ind][phase])
- print("wrote these dofs to function \n", to_function.vector()[:])
- else:
- for dof_index in interface_dofs:
- # from_function.vector() is orderd by dof and not by vertex numbering of the mesh.
- # parent needs a mesh vertex index of the submesh, therefore d2v is needed.
- to_function.vector()[dof_index] = self.pressure_values_prev[subdomain_ind][phase][parent[d2v[dof_index]]]
- print("read previous pressure interface values\n", self.pressure_values_prev[subdomain_ind][phase])
- print("wrote these dofs to function \n", to_function.vector()[:])
- if gl:
- if not previous_iter:
- for dof_index in interface_dofs:
- # from_function.vector() is orderd by dof and not by vertex numbering of the mesh.
- # parent needs a mesh vertex index of the submesh, therefore d2v is needed.
- to_function.vector()[dof_index] = self.gli_term[subdomain_ind][phase][parent[d2v[dof_index]]]
- print("read gl interface values\n", self.gli_term[subdomain_ind][phase])
- print("wrote these dofs to function \n", to_function.vector()[:])
- else:
- for dof_index in interface_dofs:
- # from_function.vector() is orderd by dof and not by vertex numbering of the mesh.
- # parent needs a mesh vertex index of the submesh, therefore d2v is needed.
- to_function.vector()[dof_index] = self.gli_term_prev[subdomain_ind][phase][parent[d2v[dof_index]]]
- print("read gl interface values\n", self.gli_term_prev[subdomain_ind][phase])
- print("wrote these dofs to function \n", to_function.vector()[:])
+
+ if not previous_iter:
+ for dof_index in interface_dofs:
+ # from_function.vector() is orderd by dof and not by vertex numbering of the mesh.
+ # parent needs a mesh vertex index of the submesh, therefore d2v is needed.
+ to_function.vector()[dof_index] = self.pressure_values[subdomain_ind][phase][parent[d2v[dof_index]]]
+ print("read pressure interface values\n", self.pressure_values[subdomain_ind][phase])
+ print("wrote these dofs to function \n", to_function.vector()[:])
+ else:
+ for dof_index in interface_dofs:
+ # from_function.vector() is orderd by dof and not by vertex numbering of the mesh.
+ # parent needs a mesh vertex index of the submesh, therefore d2v is needed.
+ to_function.vector()[dof_index] = self.pressure_values_prev[subdomain_ind][phase][parent[d2v[dof_index]]]
+ print("read previous pressure interface values\n", self.pressure_values_prev[subdomain_ind][phase])
+ print("wrote these dofs to function \n", to_function.vector()[:])
+
+
+ def read_gli_dofs(self, to_gli_array: np.array, #
+ interface_dofs: np.array,#
+ dof_to_vert_map: np.array,#
+ local_to_parent_vertex_map: np.array,#
+ phase: str,#
+ subdomain_ind: int,#
+ previous_iter: bool = False,#
+ ) -> None:
+ """ read dofs off self.gli_term and overwrite the dofs stored in the array
+ to_gli_array with indices interface_dofs
+
+ Read the degrees of freedom of one of the dictionaries of the interface
+ self.gli_term[subdomain_ind][phase], (if gl == True)
+ self.gli_term_prev[subdomain_ind][phase] (if previous_iter == True)
+ and overwrite the values (holding dofs) of the array to_gli_array with indices
+ interface_dofs, i.e. update the interface dofs of the gli terms.
+ .
+
+ # Parameters
+ to_gli_array: #type: np.array, array to overwrite the
+ dofs of.
+ interface_dofs: #type: np.array, index array of interface
+ dofs of from_function
+ dof_to_vert_map: #type: np.array, dof to vert map of the function
+ space on the submesh.
+ local_to_parent_vertex_map: #type: np.array,
+ phase #type: str is either 'wetting' or
+ 'nonwetting' and determins
+ the dict to be read of.
+ subdomain_ind #type: int subdomain index
+
+ previous_iter #type: bool determins wether a previous
+ iterate is being read or not
+ """
+ if self.pressure_values == None:
+ raise RuntimeError("self.pressure_values not initiated. You forgot to \
+ run self.init_interface_values")
+
+ parent = local_to_parent_vertex_map
+ d2v = dof_to_vert_map
+ if not previous_iter:
+ for dof_index in interface_dofs:
+ # to_gli_array is orderd by dof and not by vertex numbering of the mesh.
+ # parent needs a mesh vertex index of the submesh, therefore d2v is needed.
+ to_gli_array[dof_index] = self.gli_term[subdomain_ind][phase][parent[d2v[dof_index]]]
+ print("read gl interface values\n", self.gli_term[subdomain_ind][phase])
+ print("wrote these dofs to array \n", to_gli_array[:])
+ else:
+ for dof_index in interface_dofs:
+ # to_gli_array is orderd by dof and not by vertex numbering of the mesh.
+ # parent needs a mesh vertex index of the submesh, therefore d2v is needed.
+ to_gli_array[dof_index] = self.gli_term_prev[subdomain_ind][phase][parent[d2v[dof_index]]]
+ print("read gl interface values\n", self.gli_term_prev[subdomain_ind][phase])
+ print("wrote these dofs to array \n", to_gli_array[:])
#### Private Methods ####