From 01ca28702b888681a669bbe73bb04e0154f68af2 Mon Sep 17 00:00:00 2001
From: David Seus <david.seus@ians.uni-stuttgart.de>
Date: Fri, 8 Mar 2019 10:20:13 +0100
Subject: [PATCH] add self._init_function_space() method

---
 domainPatch.py | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/domainPatch.py b/domainPatch.py
index f03d84e..41e8e6c 100644
--- a/domainPatch.py
+++ b/domainPatch.py
@@ -69,6 +69,19 @@ class DomainPatch(df.SubDomain):
 
     ## Public Variables
 
+    self.isRichards          #type bool             set by input, see above
+    self.mesh                #type df.Mesh          set by input, see above
+    self.porosity            #type float            set by input, see above
+    self.viscosity           #type tp.List[float]   set by input, see above
+    self.has_interface       #type tp.List[int]     set by input, see above
+    self.L                   #type tp.List[float]   set by input, see above
+    self.lambda_param        #type tp.List[float]   set by input, see above
+    self.function_space      #type tp.Dict[str: df.Function]    function space
+                                                                used for wetting
+                                                                and nonwetting
+                                                                pressures. This is
+                                                                set by
+                                                                self._init_function_space()
     ## Public Methods
 
 
@@ -100,9 +113,26 @@ class DomainPatch(df.SubDomain):
         self.L = L
         self.lambda_param = lambda_param
 
+        self._init_function_space()
+
     # END constructor
 
     #### PUBLIC METHODS
+
+    #### PRIVATE METHODS
+    def _init_function_space(self) -> None:
+        """ create function space for solution and trial functions
+
+        Note that P1 FEM is hard coded here, as it is assumed in other methods
+        aswell.
+        """
+        if self.isRichards:
+            self.function_space = {'wetting': df.FunctionSpace(self.mesh, 'P', 1)}
+        else:
+            self.function_space = {#
+                'wetting'    : df.FunctionSpace(self.mesh, 'P', 1),#
+                'nonwetting' : df.FunctionSpace(self.mesh, 'P', 1)#
+                }
     # END is_Richards
 
 # END OF CLASS DomainPatch
-- 
GitLab