Skip to content

Commit

Permalink
Fix error in calculating relative thicknesses
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin865 committed Nov 12, 2021
1 parent 677db9e commit 2f31737
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/scaffoldmaker/meshtypes/meshtype_3d_stomach1.py
Original file line number Diff line number Diff line change
Expand Up @@ -1992,8 +1992,9 @@ def generateBaseMesh(cls, region, options):
if elementsCountThroughWall > 1:
thicknessProportionsUI = [0.0, mucosaRelThickness, submucosaRelThickness, circularRelThickness,
longitudinalRelThickness, longitudinalRelThickness]
thicknessProportions = [thicknessProportion / sum(thicknessProportionsUI)
thicknessProportions = [thicknessProportion / sum(thicknessProportionsUI[:-1])
for thicknessProportion in thicknessProportionsUI]

xi3List = []
xi3 = 0.0
for i in range(len(thicknessProportions) - 1):
Expand Down
8 changes: 4 additions & 4 deletions tests/test_stomach.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def test_stomach1(self):
coordinates = fieldmodule.findFieldByName("coordinates").castFiniteElement()
self.assertTrue(coordinates.isValid())
minimums, maximums = evaluateFieldNodesetRange(coordinates, nodes)
assertAlmostEqualList(self, minimums, [-18.214909076136756, -16.010042251585798, -8.882419863214968], 1.0E-6)
assertAlmostEqualList(self, maximums, [18.262047678184306, 15.214807824088728, 8.881936264327805], 1.0E-6)
assertAlmostEqualList(self, minimums, [-18.238549598577396, -16.033751319943754, -8.905924748773598], 1.0E-6)
assertAlmostEqualList(self, maximums, [18.285156743233415, 15.214807824088728, 8.905433142848109], 1.0E-6)

with ChangeManager(fieldmodule):
one = fieldmodule.createFieldConstant(1.0)
Expand All @@ -84,10 +84,10 @@ def test_stomach1(self):
fieldcache = fieldmodule.createFieldcache()
result, surfaceArea = surfaceAreaField.evaluateReal(fieldcache, 1)
self.assertEqual(result, RESULT_OK)
self.assertAlmostEqual(surfaceArea, 2548.511860089027, delta=1.0E-6)
self.assertAlmostEqual(surfaceArea, 2557.832902256128, delta=1.0E-6)
result, volume = volumeField.evaluateReal(fieldcache, 1)
self.assertEqual(result, RESULT_OK)
self.assertAlmostEqual(volume, 769.8802118839903, delta=1.0E-6)
self.assertAlmostEqual(volume, 809.0349219398828, delta=1.0E-6)

# check some annotationGroups:
expectedSizes3d = {
Expand Down

0 comments on commit 2f31737

Please sign in to comment.