Skip to content

Commit

Permalink
update 3d
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Dec 5, 2023
1 parent f815363 commit d0210fb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
26 changes: 18 additions & 8 deletions Source/Diagnostics/ComputeDiagFunctors/RecordingPlaneFunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ amrex::Real interp_to_slice (int i, int j,
Real const w = z - Real(iz);
#if (AMREX_SPACEDIM == 1)
amrex::ignore_unused(i,j);
amrex::Abort("xxxxx todo");
amrex::Abort("interp_to_slice: 1D not supported");
return 0;
#elif (AMREX_SPACEDIM == 2)
amrex::ignore_unused(j);
Expand All @@ -33,8 +33,20 @@ amrex::Real interp_to_slice (int i, int j,
src(i ,iz,0)*(Real(1.0)-w) + src(i ,iz+1,0)*w);
}
#else
amrex::Abort("xxxxx todo");
return 0;
if (type.nodeCentered(0) && type.nodeCentered(1)) {
return src(i,j,iz)*(Real(1.0)-w) + src(i,j,iz+1)*w;
} else if (type.nodeCentered(0)) {
return Real(0.5)*((src(i,j-1,iz )+src(i,j,iz ))*(Real(1.0)-w) +
(src(i,j-1,iz+1)+src(i,j,iz+1))* w);
} else if (type.nodeCentered(1)) {
return Real(0.5)*((src(i-1,j,iz )+src(i,j,iz ))*(Real(1.0)-w) +
(src(i-1,j,iz+1)+src(i,j,iz+1))* w);
} else {
return Real(0.25)*((src(i-1,j-1,iz )+src(i,j-1,iz ) +
src(i-1,j ,iz )+src(i,j ,iz ))*(Real(1.0)-w) +
(src(i-1,j-1,iz+1)+src(i,j-1,iz+1) +
src(i-1,j ,iz+1)+src(i,j ,iz+1))* w);
}
#endif
}

Expand Down Expand Up @@ -67,6 +79,8 @@ RecordingPlaneFunctor::operator() (amrex::MultiFab& mf_dst, const int dcomp, con

amrex::Vector<int> slice_to_full_ba_map;
std::unique_ptr<amrex::MultiFab> slice = AllocateSlice(slice_to_full_ba_map, slice_k);
// slice is cell-centered in z-direction and nodal in others. There is
// only one cell in the z-direction.

for (auto& smf : m_arr_mf_src) {
AMREX_ALWAYS_ASSERT(smf->nGrowVect().allGE(amrex::IntVect(1)));
Expand Down Expand Up @@ -117,11 +131,7 @@ RecordingPlaneFunctor::PrepareFunctorData (int i_station, bool slice_in_domain,
amrex::ignore_unused(i_station, slice_in_domain, zlocation, buffer_full);
m_buffer_box = buffer_box;
m_k_index = k_index;
if (slice_in_domain == true) {
m_slice_in_domain = 1;
} else {
m_slice_in_domain = 0;
}
m_slice_in_domain = slice_in_domain;
}

std::unique_ptr<amrex::MultiFab>
Expand Down
9 changes: 5 additions & 4 deletions Source/Laser/LaserProfilesImpl/LaserProfileStationField.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "Laser/LaserProfiles.H"
#include "WarpX.H"
#include "Utils/TextMsg.H"
#include "Utils/WarpXConst.H"

#include <AMReX_VisMF.H>
Expand Down Expand Up @@ -58,9 +59,9 @@ void StationFieldLaserProfile::update (amrex::Real t)
amrex::VisMF::Read(mf, m_station_file+"/Level_0/buffer-"
+std::to_string(m_ibuffer));

amrex::Print() << "xxxxx LaserProfileStationField: reading "
<< m_station_file+"/Level_0/buffer-"+std::to_string(m_ibuffer)
<< "\n";
std::string msg("LaserProfileStationField: reading ");
msg.append(m_station_file).append("/Level_0/buffer-").append(std::to_string(m_ibuffer));
amrex::Print() << Utils::TextMsg::Info(msg);

m_station_mf = std::make_unique<amrex::MultiFab>
(mf.boxArray(), mf.DistributionMap(), 1, 0);
Expand Down Expand Up @@ -88,7 +89,7 @@ void StationFieldLaserProfile::update (amrex::Real t)
m_station_mf.reset();
m_slice_fab.reset();

amrex::Print() << "xxxxx LaserProfileStationField: no more data\n";
amrex::Print() << Utils::TextMsg::Info("LaserProfileStationField: no more data");

return;
}
Expand Down

0 comments on commit d0210fb

Please sign in to comment.