View Issue Details

IDProjectCategoryView StatusLast Update
0004010OpenFOAMPatchpublic2024-07-10 16:28
Reporterhandrake0724 Assigned Towill  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionno change required 
Product Versiondev 
Summary0004010: suggestion to cutTriTet template class
DescriptionIf I am not mistaken, areaIntegrateOp can only do area moment but do not second/product moment of area.

the constructor takes moment arm data in the form of triangular points and in the function call operator, it takes triangle data.
the moment arm is automatically calculated with the moment arm data take from the constructor.

I think in this form, it is not possible to provide x^2, yx as a moment arm for the calculation of second/product moment of area.

Instead, taking triangle data in the constructor and provide moment arm data in the function call operator could provide further functionalities including the original one.

if its usage in the OpenFOAM source code is using just triangle data by providing points on the triangle data, I think this change would not affect that much.

if it is possible, then areaIntegrateOp, areaMagIntegrateOp, and volumeIntegrateOp will have similar changes.

TagsNo tags attached.

Activities

handrake0724

2023-08-19 08:35

viewer  

patch.diff (3,031 bytes)   
diff --git a/src/meshTools/cutTriTet/cutTriTet.H b/src/meshTools/cutTriTet/cutTriTet.H
index 8d667c2f1a..6257b34f1f 100644
--- a/src/meshTools/cutTriTet/cutTriTet.H
+++ b/src/meshTools/cutTriTet/cutTriTet.H
@@ -285,9 +285,9 @@ public:
     // Constructors
 
         //- Construct from base
-        areaIntegrateOp(const FixedList<Type, 3>& x)
+        areaIntegrateOp(const FixedList<Type, 3>& tri)
         :
-            FixedList<Type, 3>(x)
+            FixedList<Type, 3>(tri)
         {}
 
 
@@ -300,11 +300,18 @@ public:
         }
 
         //- Operate on a triangle
-        result operator()(const FixedList<point, 3>& p) const
+        result operator()(const FixedList<point, 3>& x) const
+        {
+            const FixedList<Type, 3>& tri = *this;
+            return result(areaOp()(tri)*(x[0] + x[1] + x[2])/3);
+        }
+
+        result operator()(const point& x) const
         {
-            const FixedList<Type, 3>& x = *this;
-            return result(areaOp()(p)*(x[0] + x[1] + x[2])/3);
+            const FixedList<Type, 3>& tri = *this;
+            return result(areaOp()(tri)*x;
         }
+
 };
 
 
@@ -328,9 +335,9 @@ public:
     // Constructors
 
         //- Construct from base
-        areaMagIntegrateOp(const FixedList<Type, 3>& x)
+        areaMagIntegrateOp(const FixedList<Type, 3>& tri)
         :
-            FixedList<Type, 3>(x)
+            FixedList<Type, 3>(tri)
         {}
 
 
@@ -343,10 +350,16 @@ public:
         }
 
         //- Operate on a triangle
-        result operator()(const FixedList<point, 3>& p) const
+        result operator()(const FixedList<point, 3>& x) const
         {
-            const FixedList<Type, 3>& x = *this;
-            return result(areaMagOp()(p)*(x[0] + x[1] + x[2])/3);
+            const FixedList<Type, 3>& tri = *this;
+            return result(areaMagOp()(tri)*(x[0] + x[1] + x[2])/3);
+        }
+
+        result operator()(const point& x) const
+        {
+            const FixedList<Type, 3>& tri = *this;
+            return result(areaMagOp()(tri)*x;
         }
 };
 
@@ -371,9 +384,9 @@ public:
     // Constructors
 
         //- Construct from base
-        volumeIntegrateOp(const FixedList<Type, 4>& x)
+        volumeIntegrateOp(const FixedList<Type, 4>& tet)
         :
-            FixedList<Type, 4>(x)
+            FixedList<Type, 4>(tet)
         {}
 
 
@@ -386,10 +399,16 @@ public:
         }
 
         //- Operate on a tetrahedron
-        result operator()(const FixedList<point, 4>& p) const
+        result operator()(const FixedList<point, 4>& x) const
+        {
+            const FixedList<Type, 4>& tet = *this;
+            return result(volumeOp()(tet)*(x[0] + x[1] + x[2] + x[3])/4);
+        }
+
+        result operator()(const point& x) const
         {
-            const FixedList<Type, 4>& x = *this;
-            return result(volumeOp()(p)*(x[0] + x[1] + x[2] + x[3])/4);
+            const FixedList<Type, 4>& tet = *this;
+            return result(volumeOp()(tet)*x;
         }
 };
 
patch.diff (3,031 bytes)   

administrator

2023-08-19 09:12

administrator   ~0013104

Pending funding

dudemariaa

2024-07-09 10:19

reporter   ~0013304

Hi,
It seems that areaIntegrateOp currently handles area moments but not second or product moments of area. Modifying its functionality to accept moment arm data in the function call operator rather than just during construction could enhance its capabilities to compute x^2, yx moments. This change might not significantly impact existing usage in OpenFOAM if it continues to provide triangle data in the constructor.

Thanks

will

2024-07-10 16:28

manager   ~0013307

Not clear what the purpose is. A support arrangement would be required to customise the code for use in this way. Closing.

Issue History

Date Modified Username Field Change
2023-08-19 08:35 handrake0724 New Issue
2023-08-19 08:35 handrake0724 File Added: patch.diff
2023-08-19 09:12 administrator Note Added: 0013104
2024-07-09 10:19 dudemariaa Note Added: 0013304
2024-07-10 16:28 will Assigned To => will
2024-07-10 16:28 will Status new => closed
2024-07-10 16:28 will Resolution open => no change required
2024-07-10 16:28 will Note Added: 0013307