diff options
author | 2017-12-04 15:42:20 -0800 | |
---|---|---|
committer | 2017-12-04 15:42:20 -0800 | |
commit | 2cb9607db613e5f1bff48b2b0de94ed06412e3b0 (patch) | |
tree | 2b1e92decde80055fe9db0dcbd1f35ed68f65a06 /Source/WarpXIO.cpp | |
parent | eab724c5391f29f19cf75e16f1348120cf0ca0a3 (diff) | |
parent | 5a33f6890451b27bb8a2930faeea431beb58910d (diff) | |
download | WarpX-2cb9607db613e5f1bff48b2b0de94ed06412e3b0.tar.gz WarpX-2cb9607db613e5f1bff48b2b0de94ed06412e3b0.tar.zst WarpX-2cb9607db613e5f1bff48b2b0de94ed06412e3b0.zip |
Merge branch 'master' into io
Conflicts:
Source/WarpX.cpp
Diffstat (limited to 'Source/WarpXIO.cpp')
-rw-r--r-- | Source/WarpXIO.cpp | 60 |
1 files changed, 54 insertions, 6 deletions
diff --git a/Source/WarpXIO.cpp b/Source/WarpXIO.cpp index dd7a4a894..69e7e73e1 100644 --- a/Source/WarpXIO.cpp +++ b/Source/WarpXIO.cpp @@ -387,6 +387,54 @@ WarpX::InitFromCheckpoint () } +std::unique_ptr<MultiFab> +WarpX::GetCellCenteredData() { + + BL_PROFILE("WarpX::GetCellCenteredData"); + + const int ng = 1; + const int nc = 10; + const int lev = 0; + auto cc = std::unique_ptr<MultiFab>( new MultiFab(boxArray(lev), + DistributionMap(lev), + nc, ng) ); + + Array<const MultiFab*> srcmf(BL_SPACEDIM); + int dcomp = 0; + + // first the electric field + PackPlotDataPtrs(srcmf, Efield_aux[lev]); + amrex::average_edge_to_cellcenter(*cc, dcomp, srcmf); +#if (BL_SPACEDIM == 2) + MultiFab::Copy(*cc, *cc, dcomp+1, dcomp+2, 1, ng); + amrex::average_node_to_cellcenter(*cc, dcomp+1, *Efield_aux[lev][1], 0, 1); +#endif + dcomp += 3; + + // then the magnetic field + PackPlotDataPtrs(srcmf, Bfield_aux[lev]); + amrex::average_face_to_cellcenter(*cc, dcomp, srcmf); +#if (BL_SPACEDIM == 2) + MultiFab::Copy(*cc, *cc, dcomp+1, dcomp+2, 1, ng); + MultiFab::Copy(*cc, *Bfield_aux[lev][1], 0, dcomp+1, 1, ng); +#endif + dcomp += 3; + + // then the current density + PackPlotDataPtrs(srcmf, current_fp[lev]); + amrex::average_edge_to_cellcenter(*cc, dcomp, srcmf); +#if (BL_SPACEDIM == 2) + MultiFab::Copy(*cc, *cc, dcomp+1, dcomp+2, 1, ng); + amrex::average_node_to_cellcenter(*cc, dcomp+1, *current_fp[lev][1], 0, 1); +#endif + dcomp += 3; + + const std::unique_ptr<MultiFab>& charge_density = mypc->GetChargeDensity(lev); + amrex::average_node_to_cellcenter(*cc, dcomp, *charge_density, 0, 1); + + return cc; +} + void WarpX::WritePlotFile () const { @@ -740,9 +788,9 @@ WarpX::WritePlotFile () const Vector<std::string> particle_varnames; particle_varnames.push_back("weight"); - particle_varnames.push_back("velocity_x"); - particle_varnames.push_back("velocity_y"); - particle_varnames.push_back("velocity_z"); + particle_varnames.push_back("momentum_x"); + particle_varnames.push_back("momentum_y"); + particle_varnames.push_back("momentum_z"); particle_varnames.push_back("Ex"); particle_varnames.push_back("Ey"); @@ -848,9 +896,9 @@ WritePlotFileES (const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho, Vector<std::string> particle_varnames; particle_varnames.push_back("weight"); - particle_varnames.push_back("velocity_x"); - particle_varnames.push_back("velocity_y"); - particle_varnames.push_back("velocity_z"); + particle_varnames.push_back("momentum_x"); + particle_varnames.push_back("momentum_y"); + particle_varnames.push_back("momentum_z"); particle_varnames.push_back("Ex"); particle_varnames.push_back("Ey"); |