Skip to content

update the dambreak demo test files to use createZones#306

Open
muezabdalla wants to merge 1 commit into
jaheyns:devfrom
muezabdalla:fix_dam_test
Open

update the dambreak demo test files to use createZones#306
muezabdalla wants to merge 1 commit into
jaheyns:devfrom
muezabdalla:fix_dam_test

Conversation

@muezabdalla

Copy link
Copy Markdown
Contributor

No description provided.

@kevinsmia1939

Copy link
Copy Markdown
Contributor

I believe that this patch does not solve the core issue that cause the test to fail. Maybe something like this?

diff --git a/CfdOF/Solve/CfdCaseWriterFoam.py b/CfdOF/Solve/CfdCaseWriterFoam.py
index 0987b78..05c3ce9 100644
--- a/CfdOF/Solve/CfdCaseWriterFoam.py
+++ b/CfdOF/Solve/CfdCaseWriterFoam.py
@@ -136,6 +136,7 @@ class CfdCaseWriterFoam:
             'initialisationZonesPresent': len(self.initialisation_zone_objs) > 0,
             'zones': {o.Label: {'PartNameList': tuple(r[0].Name for r in o.ShapeRefs)} for o in self.zone_objs},
             'zonesPresent': len(self.zone_objs) > 0,
+            'useCreateZones': False,
             'meshType': self.mesh_obj.Proxy.Type,
             'meshDimension': self.mesh_obj.ElementDimension,
             'meshDir': os.path.relpath(os.path.join(self.working_dir, self.mesh_obj.CaseName), self.case_folder),
@@ -199,6 +200,8 @@ class CfdCaseWriterFoam:
             cfdMessage('Dynamic mesh adaptation rule present\n')
             self.processDynamicMeshRefinement()
 
+        self.processZoneCommandSettings()
+
         self.settings['createPatchesFromSnappyBaffles'] = False
         self.settings['createPatchesForPeriodics'] = False
         cfdMessage("Matching boundary conditions ...\n")
@@ -815,6 +818,15 @@ class CfdCaseWriterFoam:
                 if 'Pressure' in z:
                     z['KinematicPressure'] = z['Pressure']/settings['fluidProperties'][0]['Density']
 
+    def processZoneCommandSettings(self):
+        settings = self.settings
+        # createZones creates cellZones only. Initialisation zones are consumed by setFields
+        # through cellToCell/cellToFace regions, which require the cellSet from topoSet.
+        settings['useCreateZones'] = (
+            settings['zonesPresent'] and
+            not settings['initialisationZonesPresent']
+        )
+
     def bafflesPresent(self):
         for b in self.bc_group:
             if b.BoundaryType == 'baffle':
diff --git a/Data/Templates/case/Allrun b/Data/Templates/case/Allrun
index 217a146..f9be3d9 100644
--- a/Data/Templates/case/Allrun
+++ b/Data/Templates/case/Allrun
@@ -169,6 +169,8 @@ fi
 %{%(zonesPresent%)
 %:True
 # Set cell zones contained inside the .stl surfaces
+%{%(useCreateZones%)
+%:True
 which createZones > /dev/null 2>&1
 if [ $? == 0 ]
 then
@@ -176,6 +178,9 @@ then
 else
 	runCommand topoSet -dict system/topoSetZonesDict
 fi
+%:False
+runCommand topoSet -dict system/topoSetZonesDict
+%}
 
 %}
 %{%(initialisationZonesPresent%)
diff --git a/Data/Templates/case/Allrun.ps1 b/Data/Templates/case/Allrun.ps1
index 6e3664a..da3909a 100644
--- a/Data/Templates/case/Allrun.ps1
+++ b/Data/Templates/case/Allrun.ps1
@@ -166,6 +166,8 @@ if( (Get-Command createNonConformalCouples) )
 %{%(zonesPresent%)
 %:True
 # Set cell zones contained inside the .stl surfaces
+%{%(useCreateZones%)
+%:True
 if( (Get-Command createZones) )
 {
 	runCommand createZones -dict system/createZonesDict
@@ -174,6 +176,9 @@ else
 {
 	runCommand topoSet -dict system/topoSetZonesDict
 }
+%:False
+runCommand topoSet -dict system/topoSetZonesDict
+%}
 
 %}
 %{%(initialisationZonesPresent%)

@muezabdalla

Copy link
Copy Markdown
Contributor Author

the createZones utility is only available in the foundation version.
so we should make it detect if the version that is being used is the foundation in the shell script (like all the other features implemented until now)

here is the PR that add the implementation of the createZones utility:
#295
I just forgot to update the test files of the dambreak demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants