Skip to content

Commit

Permalink
var beta for 1D
Browse files Browse the repository at this point in the history
  • Loading branch information
RevathiJambunathan committed Nov 26, 2024
1 parent 0a3d04a commit d71e3cb
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,17 @@ void MLCurlCurl::smooth1D (int amrlev, int mglev, MF& sol, MF const& rhs,
rhs[0].DistributionMap(), 1, 0, MFInfo().SetAlloc(false));

if (m_bcoefs[amrlev][mglev][0]) {
amrex::Abort("xxxxx"); // TODO
auto const& bcx = m_bcoefs[amrlev][mglev][0]->const_arrays();
auto const& bcy = m_bcoefs[amrlev][mglev][1]->const_arrays();
auto const& bcz = m_bcoefs[amrlev][mglev][2]->const_arrays();
ParallelFor( nmf, [=] AMREX_GPU_DEVICE(int bno, int i, int j, int k)
{
mlcurlcurl_1D(i,j,k,ex[bno],ey[bno],ez[bno],
rhsx[bno],rhsy[bno],rhsz[bno],
bcx[bno],bcy[bno],bcz[bno],
adxinv,color,dinfo);
});
Gpu::streamSynchronize();
} else {
ParallelFor( nmf, [=] AMREX_GPU_DEVICE(int bno, int i, int j, int k)
{
Expand Down
41 changes: 41 additions & 0 deletions Src/LinearSolvers/MLMG/AMReX_MLCurlCurl_K.H
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,47 @@ void mlcurlcurl_1D (int i, int j, int k,
ez(i,j,k) += res_z/gamma_z;
}
}


AMREX_GPU_DEVICE AMREX_FORCE_INLINE
void mlcurlcurl_1D (int i, int j, int k,
Array4<Real> const& ex,
Array4<Real> const& ey,
Array4<Real> const& ez,
Array4<Real const> const& rhsx,
Array4<Real const> const& rhsy,
Array4<Real const> const& rhsz,
Array4<Real const> const& betax,
Array4<Real const> const& betay,
Array4<Real const> const& betaz,
GpuArray<Real,AMREX_SPACEDIM> const& adxinv,
int color,
CurlCurlDirichletInfo const& dinfo)
{
if (dinfo.is_dirichlet_node(i,j,k)) {return; }
Real dxx = adxinv[0] * adxinv[0];

int my_color = i%2;

if (my_color == color)
{
ex(i,j,k) = rhsx(i,j,k) / betax(i,j,k);

Real gamma_y = dxx * Real(2.0) + betay(i,j,k);
Real ccey = - dxx * (ey(i-1,j ,k ) +
ey(i+1,j ,k ) );
Real res_y = rhsy(i,j,k) - ( gamma_y * ey(i,j,k) + ccey );
ey(i,j,k) += res_y/gamma_y;

Real gamma_z = dxx * Real(2.0) + betaz(i,j,k);
Real ccez = -dxx * (ez(i-1,j ,k ) +
ez(i+1,j ,k ) );
Real res_z = rhsz(i,j,k) - ( gamma_z * ez(i,j,k) + ccez );
ez(i,j,k) += res_z/gamma_z;
}
}


#endif

#if (AMREX_SPACEDIM > 1)
Expand Down

0 comments on commit d71e3cb

Please sign in to comment.