Skip to content

Commit

Permalink
Added areaBoun to compute the area of EB.
Browse files Browse the repository at this point in the history
  • Loading branch information
skang67 committed Feb 14, 2025
1 parent 49e2f0d commit 8da7aff
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
29 changes: 25 additions & 4 deletions Source/EB/ERF_EBAux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ define( int const& a_idim,
m_facecent[idim] = new MultiCutFab(faceba, a_dmap, AMREX_SPACEDIM-1, a_ngrow[2], *m_cellflags);
}

m_bndryarea = new MultiCutFab(grids, a_dmap, 1, a_ngrow[2], *m_cellflags);
m_bndrycent = new MultiCutFab(grids, a_dmap, AMREX_SPACEDIM, a_ngrow[2], *m_cellflags);
m_bndrynorm = new MultiCutFab(grids, a_dmap, AMREX_SPACEDIM, a_ngrow[2], *m_cellflags);

#if 0
m_centroid = new MultiCutFab(a_ba, a_dm, AMREX_SPACEDIM, m_ngrow[1], *m_cellflags);
m_bndrycent = new MultiCutFab(a_ba, a_dm, AMREX_SPACEDIM, m_grow[2], *m_cellflags);

m_bndryarea = new MultiCutFab(a_ba, a_dm, 1, m_grow[2], *m_cellflags);
m_bndrynorm = new MultiCutFab(a_ba, a_dm, AMREX_SPACEDIM, m_grow[2], *m_cellflags);
#endif

const auto& FlagFab = a_factory->getMultiEBCellFlagFab(); // EBFArrayBoxFactory, EBDataCollection
Expand Down Expand Up @@ -88,6 +88,10 @@ define( int const& a_idim,
Array4<Real> const& aux_fcent_y = m_facecent[1]->array(mfi);
Array4<Real> const& aux_fcent_z = m_facecent[2]->array(mfi);

Array4<Real> const& aux_barea = m_bndryarea->array(mfi);
Array4<Real> const& aux_bcent = m_bndrycent->array(mfi);
Array4<Real> const& aux_bnorm = m_bndrynorm->array(mfi);

bool is_per = a_geom.isPeriodic(a_idim);

ParallelFor(bx, [
Expand All @@ -98,6 +102,7 @@ define( int const& a_idim,
aux_flag, aux_vfrac,
aux_afrac_x, aux_afrac_y, aux_afrac_z,
aux_fcent_x, aux_fcent_y, aux_fcent_z,
aux_barea, aux_bcent, aux_bnorm,
vdim, idim=a_idim, is_per ]
AMREX_GPU_DEVICE (int i, int j, int k) noexcept
{
Expand Down Expand Up @@ -130,6 +135,16 @@ define( int const& a_idim,
aux_fcent_z(i,j,k+1,0) = 0.0; aux_fcent_z(i,j,k+1,1) = 0.0;
}

aux_barea(i,j,k) = 0.0;

aux_bcent(i,j,k,0) = 0.0;
aux_bcent(i,j,k,1) = 0.0;
aux_bcent(i,j,k,2) = 0.0;

aux_bnorm(i,j,k,0) = 0.0;
aux_bnorm(i,j,k,1) = 0.0;
aux_bnorm(i,j,k,2) = 0.0;

// Index for low and hi cells
IntVect iv_hi(i,j,k);
IntVect iv_lo(iv_hi - vdim);
Expand Down Expand Up @@ -536,6 +551,12 @@ define( int const& a_idim,

// Need to fill the nodes the big ends?

aux_barea(i,j,k) = lo_eb_cc.areaBoun() + hi_eb_cc.areaBoun();

// aux_bcent(i,j,k)
// aux_bnorm(i,j,k)


}

} // flag(iv_lo) and flag(iv_hi)
Expand Down
9 changes: 9 additions & 0 deletions Source/EB/ERF_EBCutCell.H
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ class eb_cut_cell_ {
return m_invert*area + (1.-m_invert)*(m_rbox_area[a_idim] - area);
}

[[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
amrex::Real areaBoun () const noexcept {
// amrex::Real area(0.);
// if (m_flag.isSingleValued()) {
// area = m_F7.area();
// }
return m_F7.area();
}

[[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
amrex::Array<amrex::Real,AMREX_SPACEDIM> fcentLo ( int const a_idim ) const noexcept {
AMREX_ASSERT( a_idim >=0 && a_idim < AMREX_SPACEDIM );
Expand Down

0 comments on commit 8da7aff

Please sign in to comment.