Skip to content

EB generation fails for STL files with certain EB options #4684

@ankithadas

Description

@ankithadas

EB Generation results in out of bounds values for EB boundary centroid (outside -0.5 to 0.5 range) for certain geometry types. To reproduce this, add

diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp
index 863bfb501..6c64987ec 100644
--- a/Src/EB/AMReX_EB2_3D_C.cpp
+++ b/Src/EB/AMReX_EB2_3D_C.cpp
@@ -128,7 +128,19 @@ void set_eb_data (const int i, const int j, const int k,
     bcent(i,j,k,0) = (Bx + nx*vfrac(i,j,k)) * apnorminv * dx[1] * dx[2];
     bcent(i,j,k,1) = (By + ny*vfrac(i,j,k)) * apnorminv * dx[0] * dx[2];
     bcent(i,j,k,2) = (Bz + nz*vfrac(i,j,k)) * apnorminv * dx[0] * dx[1];
-
+    // check. The value put here is rather arbitrary...
+    bool a1 = bcent(i,j,k,0) > 2;
+    bool a2 = bcent(i,j,k,1) > 2;
+    bool a3 = bcent(i,j,k,2) > 2;
+    
+    if (a1 || a2 || a3) {
+        amrex::Print(amrex::Print::AllProcs) << "Bcent values (" << bcent(i,j,k,0) << ","
+                                           << bcent(i,j,k,1) << ","
+                                           << bcent(i,j,k,2) << ") at index "
+                            << "(" << i << "," << j << "," << k << ")\n";
+        amrex::Abort("Bcent values outside range!");
+    }
+    
     Real dx1 = dx[0];
     Real dx2 = dx1*dx1;
     Real dx3 = dx2*dx1;

and run amrex-tutorials/ExampleCodes/EB/STLtest with inputs

eb2.geom_type             = stl
eb2.stl_file              = B1-5-ascii.txt

eb2.stl_scale             = 1e-3                   # default is 1
eb2.stl_center            = 0      0      0     # default is (0,0,0)
eb2.stl_reverse_normal    = 0                   # default is 0.
eb2.cover_multiple_cuts   = 1
#eb2.small_volfrac=0.05

prob_lo        =   -0.6  -0.6  0.00     # Lo corner coordinates
prob_hi        =   +0.6   0.6  0.60    # Hi corner coordinates

ncells                = 128    128     64

max_grid_size         = 32

with STL file attached.
B1-5-ascii.txt

Adding small vfrac fixes this specific case. This problem seems to persist for other cases as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions