diff options
author | 2020-01-31 12:19:05 -0800 | |
---|---|---|
committer | 2020-01-31 12:19:05 -0800 | |
commit | 6651d1df96f67e162ced862093633e925cbc8133 (patch) | |
tree | 25be32604c7ee0b8cebd1e2e9f770d84a9aaa5ca /Source | |
parent | e1a4813b2cf90ba8112acd6211304a3c92d09af9 (diff) | |
parent | 3f5bcb4a798862e0a5aa604e5dce162bb0e291b3 (diff) | |
download | WarpX-6651d1df96f67e162ced862093633e925cbc8133.tar.gz WarpX-6651d1df96f67e162ced862093633e925cbc8133.tar.zst WarpX-6651d1df96f67e162ced862093633e925cbc8133.zip |
Merge branch 'dev' into soa_to_aos
Diffstat (limited to 'Source')
157 files changed, 1912 insertions, 344 deletions
diff --git a/Source/BoundaryConditions/PML.H b/Source/BoundaryConditions/PML.H index 5ab84439f..b8ed0ff7a 100644 --- a/Source/BoundaryConditions/PML.H +++ b/Source/BoundaryConditions/PML.H @@ -1,3 +1,11 @@ +/* Copyright 2019 Andrew Myers, Aurore Blelly, Axel Huebl + * Maxence Thevenet, Remi Lehe, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <array> #ifndef WARPX_PML_H_ diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp index 51439430d..3f2acc6a8 100644 --- a/Source/BoundaryConditions/PML.cpp +++ b/Source/BoundaryConditions/PML.cpp @@ -1,3 +1,11 @@ +/* Copyright 2019 Andrew Myers, Aurore Blelly, Axel Huebl + * Maxence Thevenet, Remi Lehe, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <PML.H> #include <WarpX.H> #include <WarpXConst.H> diff --git a/Source/BoundaryConditions/PML_current.H b/Source/BoundaryConditions/PML_current.H index fa5bbf3f9..1d0249d56 100644 --- a/Source/BoundaryConditions/PML_current.H +++ b/Source/BoundaryConditions/PML_current.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Aurore Blelly, Axel Huebl, Maxence Thevenet + * Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef PML_CURRENT_H_ #define PML_CURRENT_H_ diff --git a/Source/BoundaryConditions/WarpXEvolvePML.cpp b/Source/BoundaryConditions/WarpXEvolvePML.cpp index bd29d1b65..0e3665c86 100644 --- a/Source/BoundaryConditions/WarpXEvolvePML.cpp +++ b/Source/BoundaryConditions/WarpXEvolvePML.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019 Aurore Blelly, Axel Huebl, Maxence Thevenet + * Remi Lehe, Revathi Jambunathan + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <cmath> #include <limits> diff --git a/Source/BoundaryConditions/WarpX_PML_kernels.H b/Source/BoundaryConditions/WarpX_PML_kernels.H index 89fdb4911..8a573c4b9 100644 --- a/Source/BoundaryConditions/WarpX_PML_kernels.H +++ b/Source/BoundaryConditions/WarpX_PML_kernels.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Remi Lehe, Revathi Jambunathan, Revathi Jambunathan + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PML_KERNELS_H_ #define WARPX_PML_KERNELS_H_ diff --git a/Source/Diagnostics/BackTransformedDiagnostic.H b/Source/Diagnostics/BackTransformedDiagnostic.H index 5621d48c6..0d36c97d9 100644 --- a/Source/Diagnostics/BackTransformedDiagnostic.H +++ b/Source/Diagnostics/BackTransformedDiagnostic.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Andrew Myers, Axel Huebl, Maxence Thevenet + * Revathi Jambunathan, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_BackTransformedDiagnostic_H_ #define WARPX_BackTransformedDiagnostic_H_ diff --git a/Source/Diagnostics/BackTransformedDiagnostic.cpp b/Source/Diagnostics/BackTransformedDiagnostic.cpp index 452828f02..0f45c9f42 100644 --- a/Source/Diagnostics/BackTransformedDiagnostic.cpp +++ b/Source/Diagnostics/BackTransformedDiagnostic.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019 Andrew Myers, Axel Huebl, Maxence Thevenet + * Revathi Jambunathan, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <AMReX_MultiFabUtil.H> #include <AMReX_MultiFabUtil_C.H> @@ -559,7 +566,7 @@ BackTransformedDiagnostic(Real zmin_lab, Real zmax_lab, Real v_window_lab, std::vector<std::string> user_fields_to_dump; ParmParse pp("warpx"); bool do_user_fields; - do_user_fields = pp.queryarr("boosted_frame_diag_fields", + do_user_fields = pp.queryarr("back_transformed_diag_fields", user_fields_to_dump); // If user specifies fields to dump, overwrite ncomp_to_dump, // map_actual_fields_to_dump and mesh_field_names. diff --git a/Source/Diagnostics/ElectrostaticIO.cpp b/Source/Diagnostics/ElectrostaticIO.cpp index 332638cff..8fb90ae4c 100644 --- a/Source/Diagnostics/ElectrostaticIO.cpp +++ b/Source/Diagnostics/ElectrostaticIO.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019 Andrew Myers, Axel Huebl, David Bizzozero + * Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <WarpX_f.H> diff --git a/Source/Diagnostics/FieldIO.H b/Source/Diagnostics/FieldIO.H index 7cdc9b710..193fe8bd5 100644 --- a/Source/Diagnostics/FieldIO.H +++ b/Source/Diagnostics/FieldIO.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Axel Huebl, David Grote, Igor Andriyash + * Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_FielIO_H_ #define WARPX_FielIO_H_ diff --git a/Source/Diagnostics/FieldIO.cpp b/Source/Diagnostics/FieldIO.cpp index 9c38f1d68..26545ea04 100644 --- a/Source/Diagnostics/FieldIO.cpp +++ b/Source/Diagnostics/FieldIO.cpp @@ -1,8 +1,16 @@ +/* Copyright 2019-2020 Andrew Myers, Axel Huebl, David Grote + * Maxence Thevenet, Remi Lehe, Revathi Jambunathan + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <FieldIO.H> #ifdef WARPX_USE_OPENPMD -#include <openPMD/openPMD.hpp> +# include <openPMD/openPMD.hpp> #endif #include <AMReX_FillPatchUtil_F.H> diff --git a/Source/Diagnostics/Make.package b/Source/Diagnostics/Make.package index 710e4399b..12560b49e 100644 --- a/Source/Diagnostics/Make.package +++ b/Source/Diagnostics/Make.package @@ -15,5 +15,7 @@ ifeq ($(USE_OPENPMD), TRUE) CEXE_sources += WarpXOpenPMD.cpp endif +include $(WARPX_HOME)/Source/Diagnostics/ReducedDiags/Make.package + INCLUDE_LOCATIONS += $(WARPX_HOME)/Source/Diagnostics VPATH_LOCATIONS += $(WARPX_HOME)/Source/Diagnostics diff --git a/Source/Diagnostics/ParticleIO.cpp b/Source/Diagnostics/ParticleIO.cpp index c08d58d36..ca9e86fdd 100644 --- a/Source/Diagnostics/ParticleIO.cpp +++ b/Source/Diagnostics/ParticleIO.cpp @@ -1,3 +1,11 @@ +/* Copyright 2019 Andrew Myers, Axel Huebl, David Grote + * Luca Fedeli, Maxence Thevenet, Revathi Jambunathan + * Weiqun Zhang, levinem + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <MultiParticleContainer.H> #include <WarpX.H> diff --git a/Source/Diagnostics/ReducedDiags/FieldEnergy.H b/Source/Diagnostics/ReducedDiags/FieldEnergy.H new file mode 100644 index 000000000..82fa4b6c4 --- /dev/null +++ b/Source/Diagnostics/ReducedDiags/FieldEnergy.H @@ -0,0 +1,36 @@ +/* Copyright 2019-2020 Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ + +#ifndef WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDENERGY_H_ +#define WARPX_DIAGNOSTICS_REDUCEDDIAGS_FIELDENERGY_H_ + +#include "ReducedDiags.H" +#include <fstream> + +/** + * This class mainly contains a function that + * computes the field energy. + */ +class FieldEnergy : public ReducedDiags +{ +public: + + /** constructor + * @param[in] rd_name reduced diags names */ + FieldEnergy(std::string rd_name); + + /** This funciton computes the field energy (EF). + * EF = E eps / 2 + B / mu / 2, + * where E is the electric field, + * B is the magnetic field, + * eps is the vacuum permittivity, + * mu is the vacuum permeability. */ + virtual void ComputeDiags(int step) override final; + +}; + +#endif diff --git a/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp b/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp new file mode 100644 index 000000000..73e6a1c9a --- /dev/null +++ b/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp @@ -0,0 +1,139 @@ +/* Copyright 2019-2020 Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ + +#include "FieldEnergy.H" +#include "WarpX.H" +#include "WarpXConst.H" +#include "AMReX_REAL.H" +#include "AMReX_ParticleReduce.H" +#include <iostream> +#include <cmath> + +using namespace amrex; + +// constructor +FieldEnergy::FieldEnergy (std::string rd_name) +: ReducedDiags{rd_name} +{ + + // RZ coordinate is not working + #if (defined WARPX_DIM_RZ) + AMREX_ALWAYS_ASSERT_WITH_MESSAGE(false, + "FieldEnergy reduced diagnostics does not work for RZ coordinate."); + #endif + + // get WarpX class object + auto & warpx = WarpX::GetInstance(); + + // read number of levels + int nLevel = 0; + ParmParse pp("amr"); + pp.query("max_level", nLevel); + nLevel += 1; + + // resize data array + m_data.resize(3*nLevel,0.0); + + if (ParallelDescriptor::IOProcessor()) + { + if ( m_IsNotRestart ) + { + // open file + std::ofstream ofs; + ofs.open(m_path + m_rd_name + "." + m_extension, + std::ofstream::out | std::ofstream::app); + // write header row + ofs << "#"; + ofs << "[1]step"; + ofs << m_sep; + ofs << "[2]time(s)"; + for (int lev = 0; lev < nLevel; ++lev) + { + ofs << m_sep; + ofs << "[" + std::to_string(3+3*lev) + "]"; + ofs << "total(J)lev"+std::to_string(lev); + ofs << m_sep; + ofs << "[" + std::to_string(4+3*lev) + "]"; + ofs << "E(J)lev"+std::to_string(lev); + ofs << m_sep; + ofs << "[" + std::to_string(5+3*lev) + "]"; + ofs << "B(J)lev"+std::to_string(lev); + } + ofs << std::endl; + // close file + ofs.close(); + } + } + +} +// end constructor + +// function that computes field energy +void FieldEnergy::ComputeDiags (int step) +{ + + // Judge if the diags should be done + if ( (step+1) % m_freq != 0 ) { return; } + + // get WarpX class object + auto & warpx = WarpX::GetInstance(); + + // get number of level + auto nLevel = warpx.finestLevel() + 1; + + // loop over refinement levels + for (int lev = 0; lev < nLevel; ++lev) + { + + // get MultiFab data at lev + const MultiFab & Ex = warpx.getEfield(lev,0); + const MultiFab & Ey = warpx.getEfield(lev,1); + const MultiFab & Ez = warpx.getEfield(lev,2); + const MultiFab & Bx = warpx.getBfield(lev,0); + const MultiFab & By = warpx.getBfield(lev,1); + const MultiFab & Bz = warpx.getBfield(lev,2); + + // get cell size + Geometry const & geom = warpx.Geom(lev); + auto domain_box = geom.Domain(); + #if (AMREX_SPACEDIM == 2) + auto dV = geom.CellSize(0) * geom.CellSize(1); + #elif (AMREX_SPACEDIM == 3) + auto dV = geom.CellSize(0) * geom.CellSize(1) * geom.CellSize(2); + #endif + + // compute E squared + Real tmpx = Ex.norm2(0,geom.periodicity()); + Real tmpy = Ey.norm2(0,geom.periodicity()); + Real tmpz = Ez.norm2(0,geom.periodicity()); + Real Es = tmpx*tmpx + tmpy*tmpy + tmpz*tmpz; + + // compute B squared + tmpx = Bx.norm2(0,geom.periodicity()); + tmpy = By.norm2(0,geom.periodicity()); + tmpz = Bz.norm2(0,geom.periodicity()); + Real Bs = tmpx*tmpx + tmpy*tmpy + tmpz*tmpz; + + // save data + m_data[lev*3+1] = 0.5 * Es * PhysConst::ep0 * dV; + m_data[lev*3+2] = 0.5 * Bs / PhysConst::mu0 * dV; + m_data[lev*3+0] = m_data[lev*3+1] + m_data[lev*3+2]; + + } + // end loop over refinement levels + + /* m_data now contains up-to-date values for: + * [total field energy at level 0, + * electric field energy at level 0, + * magnetic field energy at level 0, + * total field energy at level 1, + * electric field energy at level 1, + * magnetic field energy at level 1, + * ......] */ + +} +// end void FieldEnergy::ComputeDiags diff --git a/Source/Diagnostics/ReducedDiags/Make.package b/Source/Diagnostics/ReducedDiags/Make.package new file mode 100644 index 000000000..37f76d3d5 --- /dev/null +++ b/Source/Diagnostics/ReducedDiags/Make.package @@ -0,0 +1,14 @@ +CEXE_headers += MultiReducedDiags.H +CEXE_sources += MultiReducedDiags.cpp + +CEXE_headers += ReducedDiags.H +CEXE_sources += ReducedDiags.cpp + +CEXE_headers += ParticleEnergy.H +CEXE_sources += ParticleEnergy.cpp + +CEXE_headers += FieldEnergy.H +CEXE_sources += FieldEnergy.cpp + +INCLUDE_LOCATIONS += $(WARPX_HOME)/Source/Diagnostics/ReducedDiags +VPATH_LOCATIONS += $(WARPX_HOME)/Source/Diagnostics/ReducedDiags diff --git a/Source/Diagnostics/ReducedDiags/MultiReducedDiags.H b/Source/Diagnostics/ReducedDiags/MultiReducedDiags.H new file mode 100644 index 000000000..79f487d81 --- /dev/null +++ b/Source/Diagnostics/ReducedDiags/MultiReducedDiags.H @@ -0,0 +1,47 @@ +/* Copyright 2019-2020 Maxence Thevenet, Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ + +#ifndef WARPX_DIAGNOSTICS_REDUCEDDIAGS_MULTIREDUCEDDIAGS_H_ +#define WARPX_DIAGNOSTICS_REDUCEDDIAGS_MULTIREDUCEDDIAGS_H_ + +#include "ReducedDiags.H" +#include <vector> +#include <string> +#include <memory> + +/** + * This class holds multiple instances of ReducedDiagnostics, and contains + * general functions to initialize, compute, and write these diagnostics + * to file. + */ +class MultiReducedDiags +{ +public: + + /// Bool: whether or not reduced diagnostics are activated + int m_plot_rd = 0; + + /// names of reduced diagnostics + std::vector<std::string> m_rd_names; + + /// m_multi_rd stores a pointer to each reduced diagnostics + std::vector<std::unique_ptr<ReducedDiags>> m_multi_rd; + + /// constructor + MultiReducedDiags(); + + /** Loop over all ReducedDiags and call their ComputeDiags + * @param[in] step current iteration time */ + void ComputeDiags(int step); + + /** Loop over all ReducedDiags and call their WriteToFile + * @param[in] step current iteration time */ + void WriteToFile(int step); + +}; + +#endif diff --git a/Source/Diagnostics/ReducedDiags/MultiReducedDiags.cpp b/Source/Diagnostics/ReducedDiags/MultiReducedDiags.cpp new file mode 100644 index 000000000..71a33924b --- /dev/null +++ b/Source/Diagnostics/ReducedDiags/MultiReducedDiags.cpp @@ -0,0 +1,94 @@ +/* Copyright 2019-2020 Maxence Thevenet, Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ + +#include "ParticleEnergy.H" +#include "FieldEnergy.H" +#include "MultiReducedDiags.H" +#include "AMReX_ParmParse.H" +#include "AMReX_ParallelDescriptor.H" +#include <fstream> + +using namespace amrex; + +// constructor +MultiReducedDiags::MultiReducedDiags () +{ + + // read reduced diags names + ParmParse pp("warpx"); + m_plot_rd = pp.queryarr("reduced_diags_names", m_rd_names); + + // if names are not given, reduced diags will not be done + if ( m_plot_rd == 0 ) { return; } + + // resize + m_multi_rd.resize(m_rd_names.size()); + + // loop over all reduced diags + for (int i_rd = 0; i_rd < m_rd_names.size(); ++i_rd) + { + + ParmParse pp(m_rd_names[i_rd]); + + // read reduced diags type + std::string rd_type; + pp.query("type", rd_type); + + // match diags + if (rd_type.compare("ParticleEnergy") == 0) + { + m_multi_rd[i_rd].reset + ( new ParticleEnergy(m_rd_names[i_rd])); + } + else if (rd_type.compare("FieldEnergy") == 0) + { + m_multi_rd[i_rd].reset + ( new FieldEnergy(m_rd_names[i_rd])); + } + else + { Abort("No matching reduced diagnostics type found."); } + // end if match diags + + } + // end loop over all reduced diags + +} +// end constructor + +// call functions to compute diags +void MultiReducedDiags::ComputeDiags (int step) +{ + // loop over all reduced diags + for (int i_rd = 0; i_rd < m_rd_names.size(); ++i_rd) + { + m_multi_rd[i_rd] -> ComputeDiags(step); + } + // end loop over all reduced diags +} +// end void MultiReducedDiags::ComputeDiags + +// funciton to write data +void MultiReducedDiags::WriteToFile (int step) +{ + + // Only the I/O rank does + if ( !ParallelDescriptor::IOProcessor() ) { return; } + + // loop over all reduced diags + for (int i_rd = 0; i_rd < m_rd_names.size(); ++i_rd) + { + + // Judge if the diags should be done + if ( (step+1) % m_multi_rd[i_rd]->m_freq != 0 ) { return; } + + // call the write to file function + m_multi_rd[i_rd]->WriteToFile(step); + + } + // end loop over all reduced diags +} +// end void MultiReducedDiags::WriteToFile diff --git a/Source/Diagnostics/ReducedDiags/ParticleEnergy.H b/Source/Diagnostics/ReducedDiags/ParticleEnergy.H new file mode 100644 index 000000000..d7c60a24e --- /dev/null +++ b/Source/Diagnostics/ReducedDiags/ParticleEnergy.H @@ -0,0 +1,37 @@ +/* Copyright 2019-2020 Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ + +#ifndef WARPX_DIAGNOSTICS_REDUCEDDIAGS_PARTICLEENERGY_H_ +#define WARPX_DIAGNOSTICS_REDUCEDDIAGS_PARTICLEENERGY_H_ + +#include "ReducedDiags.H" +#include <fstream> + +/** + * This class mainly contains a function that + * computes the particle relativistic kinetic energy + * of each species. + */ +class ParticleEnergy : public ReducedDiags +{ +public: + + /** constructor + * @param[in] rd_name reduced diags names */ + ParticleEnergy(std::string rd_name); + + /** This funciton computes the particle relativistic + * kinetic energy (EP). + * \param [in] step current time step + * EP = sqrt( p^2 c^2 + m^2 c^4 ) - m c^2, + * where p is the relativistic momentum, + * m is the particle rest mass. */ + virtual void ComputeDiags(int step) override final; + +}; + +#endif diff --git a/Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp b/Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp new file mode 100644 index 000000000..132ad2165 --- /dev/null +++ b/Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp @@ -0,0 +1,166 @@ +/* Copyright 2019-2020 Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ + +#include "ParticleEnergy.H" +#include "WarpX.H" +#include "WarpXConst.H" +#include "AMReX_REAL.H" +#include "AMReX_ParticleReduce.H" +#include <iostream> +#include <cmath> +#include <limits> + +using namespace amrex; + +// constructor +ParticleEnergy::ParticleEnergy (std::string rd_name) +: ReducedDiags{rd_name} +{ + // get WarpX class object + auto & warpx = WarpX::GetInstance(); + + // get MultiParticleContainer class object + auto & mypc = warpx.GetPartContainer(); + + // get number of species (int) + auto nSpecies = mypc.nSpecies(); + + // resize data array + m_data.resize(2*nSpecies+2,0.0); + + // get species names (std::vector<std::string>) + auto species_names = mypc.GetSpeciesNames(); + + if (ParallelDescriptor::IOProcessor()) + { + if ( m_IsNotRestart ) + { + // open file + std::ofstream ofs; + ofs.open(m_path + m_rd_name + "." + m_extension, + std::ofstream::out | std::ofstream::app); + // write header row + ofs << "#"; + ofs << "[1]step"; + ofs << m_sep; + ofs << "[2]time(s)"; + ofs << m_sep; + ofs << "[3]total(J)"; + for (int i = 0; i < nSpecies; ++i) + { + ofs << m_sep; + ofs << "[" + std::to_string(4+i) + "]"; + ofs << species_names[i]+"(J)"; + } + ofs << m_sep; + ofs << "[" + std::to_string(4+nSpecies) + "]"; + ofs << "total.mean(J)"; + for (int i = 0; i < nSpecies; ++i) + { + ofs << m_sep; + ofs << "[" + std::to_string(5+nSpecies+i) + "]"; + ofs << species_names[i]+".mean(J)"; + } + ofs << std::endl; + // close file + ofs.close(); + } + } + +} +// end constructor + +// function that computes kinetic energy +void ParticleEnergy::ComputeDiags (int step) +{ + + // Judge if the diags should be done + if ( (step+1) % m_freq != 0 ) { return; } + + // get MultiParticleContainer class object + auto & mypc = WarpX::GetInstance().GetPartContainer(); + + // get number of species (int) + auto nSpecies = mypc.nSpecies(); + + // get species names (std::vector<std::string>) + auto species_names = mypc.GetSpeciesNames(); + + // speed of light squared + auto c2 = PhysConst::c * PhysConst::c; + + // loop over species + for (int i_s = 0; i_s < nSpecies; ++i_s) + { + // get WarpXParticleContainer class object + auto & myspc = mypc.GetParticleContainer(i_s); + + // get mass (Real) + auto m = myspc.getMass(); + + using PType = typename WarpXParticleContainer::SuperParticleType; + + // Use amex::ReduceSum to compute the sum of energies of all particles + // held by the current MPI rank, for this species. This involves a loop over all + // boxes held by this MPI rank. + auto Etot = ReduceSum( myspc, + [=] AMREX_GPU_HOST_DEVICE (const PType& p) -> Real + { + auto w = p.rdata(PIdx::w); + auto ux = p.rdata(PIdx::ux); + auto uy = p.rdata(PIdx::uy); + auto uz = p.rdata(PIdx::uz); + auto us = (ux*ux + uy*uy + uz*uz); + return ( std::sqrt(us*c2 + c2*c2) - c2 ) * m * w; + }); + + // Same thing for the particles weights. + auto Wtot = ReduceSum( myspc, + [=] AMREX_GPU_HOST_DEVICE (const PType& p) -> Real + { + return p.rdata(PIdx::w); + }); + + // reduced sum over mpi ranks + ParallelDescriptor::ReduceRealSum + (Etot, ParallelDescriptor::IOProcessorNumber()); + ParallelDescriptor::ReduceRealSum + (Wtot, ParallelDescriptor::IOProcessorNumber()); + + // save results for this species i_s into m_data + m_data[i_s+1] = Etot; + if ( Wtot > std::numeric_limits<Real>::min() ) + { m_data[nSpecies+2+i_s] = Etot / Wtot; } + else + { m_data[nSpecies+2+i_s] = 0.0; } + + } + // end loop over species + + // save total energy + // loop over species + m_data[0] = 0.0; // total energy + m_data[nSpecies+1] = 0.0; // total mean energy + for (int i_s = 0; i_s < nSpecies; ++i_s) + { + m_data[0] += m_data[i_s+1]; + m_data[nSpecies+1] += m_data[nSpecies+2+i_s]; + } + // end loop over species + + /* m_data now contains up-to-date values for: + * [total energy (all species), + * total energy (species 1), + * ..., + * total energy (species n), + * mean energy (all species), + * mean energy (species 1), + * ..., + * mean energy (species n)] */ + +} +// end void ParticleEnergy::ComputeDiags diff --git a/Source/Diagnostics/ReducedDiags/ReducedDiags.H b/Source/Diagnostics/ReducedDiags/ReducedDiags.H new file mode 100644 index 000000000..7ff065f49 --- /dev/null +++ b/Source/Diagnostics/ReducedDiags/ReducedDiags.H @@ -0,0 +1,59 @@ +/* Copyright 2019-2020 Maxence Thevenet, Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ + +#ifndef WARPX_DIAGNOSTICS_REDUCEDDIAGS_REDUCEDDIAGS_H_ +#define WARPX_DIAGNOSTICS_REDUCEDDIAGS_REDUCEDDIAGS_H_ + +#include "AMReX_REAL.H" +#include <string> +#include <vector> +#include <fstream> + +/** + * Base class for reduced diagnostics. Each type of reduced diagnostics is + * implemented in a derived class, and must override the (pure virtual) + * function ComputeDiags. + */ +class ReducedDiags +{ +public: + + /// output path (default) + std::string m_path = "./diags/reducedfiles/"; + + /// output extension (default) + std::string m_extension = "txt"; + + /// diags name + std::string m_rd_name; + + /// output frequency + int m_freq = 1; + + /// check if it is a restart run + int m_IsNotRestart = 1; + + /// separator in the output file + std::string m_sep = ","; + + /// output data + std::vector<amrex::Real> m_data; + + /** constructor + * @param[in] rd_name reduced diags name */ + ReducedDiags(std::string rd_name); + + /// function to compute diags + virtual void ComputeDiags(int step) = 0; + + /** write to file function + * @param[in] step time step */ + virtual void WriteToFile(int step) const; + +}; + +#endif diff --git a/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp b/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp new file mode 100644 index 000000000..81831aa79 --- /dev/null +++ b/Source/Diagnostics/ReducedDiags/ReducedDiags.cpp @@ -0,0 +1,92 @@ +/* Copyright 2019-2020 Maxence Thevenet, Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ + +#include "ReducedDiags.H" +#include "WarpX.H" +#include "AMReX_ParmParse.H" +#include "AMReX_Utility.H" +#include <iomanip> + +using namespace amrex; + +// constructor +ReducedDiags::ReducedDiags (std::string rd_name) +{ + + m_rd_name = rd_name; + + ParmParse pp(m_rd_name); + + // read path + pp.query("path", m_path); + + // read extension + pp.query("extension", m_extension); + + // creater folder + if (!UtilCreateDirectory(m_path, 0755)) + { CreateDirectoryFailed(m_path); } + + // check if it is a restart run + std::string restart_chkfile = ""; + ParmParse pp_amr("amr"); + pp_amr.query("restart", restart_chkfile); + m_IsNotRestart = restart_chkfile.empty(); + + // replace / create output file + if ( m_IsNotRestart ) // not a restart + { + std::ofstream ofs; + ofs.open(m_path+m_rd_name+"."+m_extension, std::ios::trunc); + ofs.close(); + } + + // read reduced diags frequency + pp.query("frequency", m_freq); + + // read separator + pp.query("separator", m_sep); + +} +// end constructor + +// write to file function +void ReducedDiags::WriteToFile (int step) const +{ + + // open file + std::ofstream ofs; + ofs.open(m_path + m_rd_name + "." + m_extension, + std::ofstream::out | std::ofstream::app); + + // write step + ofs << step+1; + + ofs << m_sep; + + // set precision + ofs << std::fixed << std::setprecision(14) << std::scientific; + + // write time + ofs << WarpX::GetInstance().gett_new(0); + + // loop over data size and write + for (int i = 0; i < m_data.size(); ++i) + { + ofs << m_sep; + ofs << m_data[i]; + } + // end loop over data size + + // end line + ofs << std::endl; + + // close file + ofs.close(); + +} +// end ReducedDiags::WriteToFile diff --git a/Source/Diagnostics/SliceDiagnostic.H b/Source/Diagnostics/SliceDiagnostic.H index 1b9ca3967..68a8c1f92 100644 --- a/Source/Diagnostics/SliceDiagnostic.H +++ b/Source/Diagnostics/SliceDiagnostic.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Revathi Jambunathan + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_SliceDiagnostic_H_ #define WARPX_SliceDiagnostic_H_ diff --git a/Source/Diagnostics/SliceDiagnostic.cpp b/Source/Diagnostics/SliceDiagnostic.cpp index 99eec4468..c6b5dd4da 100644 --- a/Source/Diagnostics/SliceDiagnostic.cpp +++ b/Source/Diagnostics/SliceDiagnostic.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019-2020 Luca Fedeli, Revathi Jambunathan, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include "SliceDiagnostic.H" #include <AMReX_MultiFabUtil.H> #include <AMReX_PlotFileUtil.H> diff --git a/Source/Diagnostics/WarpXIO.cpp b/Source/Diagnostics/WarpXIO.cpp index d7a46f7b7..f85b9df3b 100644 --- a/Source/Diagnostics/WarpXIO.cpp +++ b/Source/Diagnostics/WarpXIO.cpp @@ -1,3 +1,12 @@ +/* Copyright 2019-2020 Andrew Myers, Ann Almgren, Axel Huebl + * Burlen Loring, David Grote, Gunther H. Weber + * Junmin Gu, Maxence Thevenet, Remi Lehe + * Revathi Jambunathan, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <AMReX_MultiFabUtil.H> #include <AMReX_PlotFileUtil.H> #include <AMReX_FillPatchUtil_F.H> @@ -19,7 +28,7 @@ #endif #ifdef WARPX_USE_OPENPMD -#include "WarpXOpenPMD.H" +# include "WarpXOpenPMD.H" #endif @@ -499,45 +508,68 @@ WarpX::UpdateInSitu () const } void -WarpX::WritePlotFile () const -{ - BL_PROFILE("WarpX::WritePlotFile()"); - - const std::string& plotfilename = amrex::Concatenate(plot_file,istep[0]); - amrex::Print() << " Writing plotfile " << plotfilename << "\n"; - +WarpX::prepareFields( + int const step, + Vector<std::string>& varnames, + Vector<MultiFab>& mf_avg, + Vector<const MultiFab*>& output_mf, + Vector<Geometry>& output_geom +) const { // Average the fields from the simulation grid to the cell centers const int ngrow = 0; - Vector<std::string> varnames; // Name of the written fields - // mf_avg will contain the averaged, cell-centered fields - Vector<MultiFab> mf_avg; WarpX::AverageAndPackFields( varnames, mf_avg, ngrow ); // Coarsen the fields, if requested by the user - Vector<const MultiFab*> output_mf; // will point to the data to be written Vector<MultiFab> coarse_mf; // will remain empty if there is no coarsening - Vector<Geometry> output_geom; if (plot_coarsening_ratio != 1) { coarsenCellCenteredFields( coarse_mf, output_geom, mf_avg, Geom(), - plot_coarsening_ratio, finest_level ); + plot_coarsening_ratio, finest_level ); output_mf = amrex::GetVecOfConstPtrs(coarse_mf); } else { // No averaging necessary, simply point to mf_avg output_mf = amrex::GetVecOfConstPtrs(mf_avg); output_geom = Geom(); } +} + +void +WarpX::WriteOpenPMDFile () const +{ + BL_PROFILE("WarpX::WriteOpenPMDFile()"); #ifdef WARPX_USE_OPENPMD - if (dump_openpmd) { - m_OpenPMDPlotWriter->SetStep(istep[0]); - // fields: only dumped for coarse level - m_OpenPMDPlotWriter->WriteOpenPMDFields( - varnames, *output_mf[0], output_geom[0], istep[0], t_new[0]); - // particles: all (reside only on locally finest level) - m_OpenPMDPlotWriter->WriteOpenPMDParticles(mypc); - } + const auto step = istep[0]; + + Vector<std::string> varnames; // Name of the written fields + Vector<MultiFab> mf_avg; // contains the averaged, cell-centered fields + Vector<const MultiFab*> output_mf; // will point to the data to be written + Vector<Geometry> output_geom; + + prepareFields(step, varnames, mf_avg, output_mf, output_geom); + + m_OpenPMDPlotWriter->SetStep(step); + // fields: only dumped for coarse level + m_OpenPMDPlotWriter->WriteOpenPMDFields( + varnames, *output_mf[0], output_geom[0], step, t_new[0]); + // particles: all (reside only on locally finest level) + m_OpenPMDPlotWriter->WriteOpenPMDParticles(mypc); #endif +} + +void +WarpX::WritePlotFile () const +{ + BL_PROFILE("WarpX::WritePlotFile()"); - if (dump_plotfiles) { + const auto step = istep[0]; + const std::string& plotfilename = amrex::Concatenate(plot_file,step); + amrex::Print() << " Writing plotfile " << plotfilename << "\n"; + + Vector<std::string> varnames; // Name of the written fields + Vector<MultiFab> mf_avg; // contains the averaged, cell-centered fields + Vector<const MultiFab*> output_mf; // will point to the data to be written + Vector<Geometry> output_geom; + + prepareFields(step, varnames, mf_avg, output_mf, output_geom); // Write the fields contained in `mf_avg`, and corresponding to the // names `varnames`, into a plotfile. @@ -620,18 +652,13 @@ WarpX::WritePlotFile () const } } - // leaving the option of binary output through AMREx around - // regardless of openPMD. This can be adjusted later - { - mypc->WritePlotFile(plotfilename); - } + mypc->WritePlotFile(plotfilename); WriteJobInfo(plotfilename); WriteWarpXHeader(plotfilename); VisMF::SetHeaderVersion(current_version); - } // endif: dump_plotfiles } diff --git a/Source/Diagnostics/WarpXOpenPMD.H b/Source/Diagnostics/WarpXOpenPMD.H index e4b48d605..bd18ec8c1 100644 --- a/Source/Diagnostics/WarpXOpenPMD.H +++ b/Source/Diagnostics/WarpXOpenPMD.H @@ -1,3 +1,10 @@ +/* Copyright 2019-2020 Axel Huebl, Junmin Gu, Maxence Thevenet + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_OPEN_PMD_H_ #define WARPX_OPEN_PMD_H_ diff --git a/Source/Diagnostics/WarpXOpenPMD.cpp b/Source/Diagnostics/WarpXOpenPMD.cpp index ed2bf8020..85c64c8c9 100644 --- a/Source/Diagnostics/WarpXOpenPMD.cpp +++ b/Source/Diagnostics/WarpXOpenPMD.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019-2020 Axel Huebl, Junmin Gu + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include "WarpXOpenPMD.H" #include "WarpXAlgorithmSelection.H" #include "FieldIO.H" // for getReversedVec @@ -90,12 +96,26 @@ WarpXOpenPMDPlot::WarpXOpenPMDPlot(bool oneFilePerTS, m_OneFilePerTS(oneFilePerTS), m_OpenPMDFileType(std::move(openPMDFileType)), m_fieldPMLdirections(std::move(fieldPMLdirections)) -{} +{ + // pick first available backend if default is chosen + if( m_OpenPMDFileType == "default" ) +#if openPMD_HAVE_ADIOS2==1 + m_OpenPMDFileType = "bp"; +#elif openPMD_HAVE_ADIOS1==1 + m_OpenPMDFileType = "bp"; +#elif openPMD_HAVE_HDF5==1 + m_OpenPMDFileType = "h5"; +#else + m_OpenPMDFileType = "json"; +#endif +} WarpXOpenPMDPlot::~WarpXOpenPMDPlot() { - if (nullptr != m_Series) { + if( m_Series ) + { m_Series->flush(); + m_Series.reset( nullptr ); } } @@ -131,31 +151,26 @@ void WarpXOpenPMDPlot::SetStep(int ts) void WarpXOpenPMDPlot::Init(openPMD::AccessType accessType) { - if (!m_OneFilePerTS) {// one file - if (nullptr != m_Series) { - return; - } - } - - // either for the next ts file, - // or init a single file for all ts - std::string filename; - GetFileName(filename); - - if (m_Series != nullptr) { - m_Series->flush(); - m_Series = nullptr; - } + // either for the next ts file, + // or init a single file for all ts + std::string filename; + GetFileName(filename); - if (amrex::ParallelDescriptor::NProcs() > 1) { - m_Series = std::make_unique<openPMD::Series>(filename, - accessType, - amrex::ParallelDescriptor::Communicator()); - m_MPISize = amrex::ParallelDescriptor::NProcs(); - m_MPIRank = amrex::ParallelDescriptor::MyProc(); - } + if( amrex::ParallelDescriptor::NProcs() > 1 ) + { + m_Series = std::make_unique<openPMD::Series>( + filename, accessType, + amrex::ParallelDescriptor::Communicator() + ); + m_MPISize = amrex::ParallelDescriptor::NProcs(); + m_MPIRank = amrex::ParallelDescriptor::MyProc(); + } else - m_Series = std::make_unique<openPMD::Series>(filename, accessType); + { + m_Series = std::make_unique<openPMD::Series>(filename, accessType); + m_MPISize = 1; + m_MPIRank = 1; + } // input file / simulation setup author if( WarpX::authors.size() > 0u ) @@ -166,8 +181,12 @@ WarpXOpenPMDPlot::Init(openPMD::AccessType accessType) uint32_t const openPMD_ED_PIC = 1u; m_Series->setOpenPMDextension( openPMD_ED_PIC ); // meta info +#if (OPENPMDAPI_VERSION_MAJOR>=0) && (OPENPMDAPI_VERSION_MINOR>=11) + m_Series->setSoftware( "WarpX", WarpX::Version() ); +#else m_Series->setSoftware( "WarpX" ); - m_Series->setSoftwareVersion( WarpX::Version() ) ; + m_Series->setSoftwareVersion( WarpX::Version() ); +#endif } @@ -248,8 +267,7 @@ WarpXOpenPMDPlot::SavePlotFile (const std::unique_ptr<WarpXParticleContainer>& p const amrex::Vector<std::string>& real_comp_names, const amrex::Vector<std::string>& int_comp_names) const { - if ( nullptr == m_Series) - return; + AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_Series != nullptr, "openPMD series must be initialized"); WarpXParticleCounter counter(pc); @@ -296,50 +314,48 @@ WarpXOpenPMDPlot::SavePlotFile (const std::unique_ptr<WarpXParticleContainer>& p SetupPos(pc, currSpecies, counter.GetTotalNumParticles()); SetupRealProperties(currSpecies, write_real_comp, real_comp_names, counter.GetTotalNumParticles()); - // forces the files created by all processors! this is the key to resolve RZ storage issue!! + // open files from all processors, in case some will not contribute below m_Series->flush(); + for (auto currentLevel = 0; currentLevel <= pc->finestLevel(); currentLevel++) { - uint64_t const numParticles = static_cast<uint64_t>( counter.m_ParticleSizeAtRank[currentLevel] ); uint64_t offset = static_cast<uint64_t>( counter.m_ParticleOffsetAtRank[currentLevel] ); - if (0u == numParticles) - return; - - // pc->NumIntComp() & NumRealComp() are protected, - // from WarpXParIter template class definition, we know that - // soa num real attributes = PIdx::nattribs, and num int in soa is 0 - for (WarpXParIter pti(*pc, currentLevel); pti.isValid(); ++pti) { auto const numParticleOnTile = pti.numParticles(); uint64_t const numParticleOnTile64 = static_cast<uint64_t>( numParticleOnTile ); // get position and particle ID from aos - // note: this implementation iterates the AoS 4x but saves memory... iterating once could be beneficial, too + // note: this implementation iterates the AoS 4x... + // if we flush late as we do now, we can also copy out the data in one go const auto& aos = pti.GetArrayOfStructs(); // size = numParticlesOnTile { // Save positions std::vector<std::string> axisNames={"x", "y", "z"}; for (auto currDim = 0; currDim < AMREX_SPACEDIM; currDim++) { - std::vector<amrex::ParticleReal> curr(numParticleOnTile, 0.); + std::shared_ptr< amrex::ParticleReal > curr( + new amrex::ParticleReal[numParticleOnTile], + [](amrex::ParticleReal const *p){ delete[] p; } + ); for (auto i=0; i<numParticleOnTile; i++) { - curr[i] = aos[i].m_rdata.pos[currDim]; + curr.get()[i] = aos[i].m_rdata.pos[currDim]; } currSpecies["position"][axisNames[currDim]].storeChunk(curr, {offset}, {numParticleOnTile64}); - m_Series->flush(); } // save particle ID after converting it to a globally unique ID - std::vector<uint64_t> ids(numParticleOnTile, 0.); + std::shared_ptr< uint64_t > ids( + new uint64_t[numParticleOnTile], + [](uint64_t const *p){ delete[] p; } + ); for (auto i=0; i<numParticleOnTile; i++) { detail::GlobalID const nextID = { aos[i].m_idata.id, aos[i].m_idata.cpu }; - ids[i] = nextID.global_id; + ids.get()[i] = nextID.global_id; } auto const scalar = openPMD::RecordComponent::SCALAR; currSpecies["id"][scalar].storeChunk(ids, {offset}, {numParticleOnTile64}); - m_Series->flush(); } - // save properties + // save "extra" particle properties in AoS and SoA SaveRealProperty(pti, currSpecies, offset, @@ -348,6 +364,7 @@ WarpXOpenPMDPlot::SavePlotFile (const std::unique_ptr<WarpXParticleContainer>& p offset += numParticleOnTile64; } } + m_Series->flush(); } void @@ -369,9 +386,32 @@ WarpXOpenPMDPlot::SetupRealProperties(openPMD::ParticleSpecies& currSpecies, std::string record_name, component_name; std::tie(record_name, component_name) = detail::name2openPMD(real_comp_names[i]); - auto& particleVarComp = currSpecies[record_name][component_name]; + auto particleVarComp = currSpecies[record_name][component_name]; particleVarComp.resetDataset(particlesLineup); } + + std::set< std::string > addedRecords; // add meta-data per record only once + for (auto idx=0; idx<m_NumSoARealAttributes; idx++) { + auto ii = m_NumAoSRealAttributes + idx; + if (write_real_comp[ii]) { + // handle scalar and non-scalar records by name + std::string record_name, component_name; + std::tie(record_name, component_name) = detail::name2openPMD(real_comp_names[ii]); + auto currRecord = currSpecies[record_name]; + + // meta data for ED-PIC extension + bool newRecord = false; + std::tie(std::ignore, newRecord) = addedRecords.insert(record_name); + if( newRecord ) { + currRecord.setUnitDimension( detail::getUnitDimension(record_name) ); + currRecord.setAttribute( "macroWeighted", 0u ); + if( record_name == "momentum" ) + currRecord.setAttribute( "weightingPower", 1.0 ); + else + currRecord.setAttribute( "weightingPower", 0.0 ); + } + } + } } void @@ -390,6 +430,7 @@ WarpXOpenPMDPlot::SaveRealProperty(WarpXParIter& pti, ++numOutputReal; auto const numParticleOnTile = pti.numParticles(); + uint64_t const numParticleOnTile64 = static_cast<uint64_t>( numParticleOnTile ); auto const& aos = pti.GetArrayOfStructs(); // size = numParticlesOnTile auto const& soa = pti.GetStructOfArrays(); @@ -400,25 +441,24 @@ WarpXOpenPMDPlot::SaveRealProperty(WarpXParIter& pti, // handle scalar and non-scalar records by name std::string record_name, component_name; std::tie(record_name, component_name) = detail::name2openPMD(real_comp_names[idx]); - auto& currRecord = currSpecies[record_name]; - auto& currRecordComp = currRecord[component_name]; + auto currRecord = currSpecies[record_name]; + auto currRecordComp = currRecord[component_name]; - amrex::ParticleReal *d = - static_cast<amrex::ParticleReal*>( malloc(sizeof(amrex::ParticleReal) * numParticleOnTile) ); + std::shared_ptr< amrex::ParticleReal > d( + new amrex::ParticleReal[numParticleOnTile], + [](amrex::ParticleReal const *p){ delete[] p; } + ); for( auto kk=0; kk<numParticleOnTile; kk++ ) - d[kk] = aos[kk].m_rdata.arr[AMREX_SPACEDIM+idx]; + d.get()[kk] = aos[kk].m_rdata.arr[AMREX_SPACEDIM+idx]; - std::shared_ptr<amrex::ParticleReal> data(d, free); - currRecordComp.storeChunk(data, - {offset}, {static_cast<unsigned long long>(numParticleOnTile)}); - m_Series->flush(); + currRecordComp.storeChunk(d, + {offset}, {numParticleOnTile64}); } } } { - std::set< std::string > addedRecords; // add meta-data per record only once for (auto idx=0; idx<m_NumSoARealAttributes; idx++) { auto ii = m_NumAoSRealAttributes + idx; if (write_real_comp[ii]) { @@ -428,23 +468,10 @@ WarpXOpenPMDPlot::SaveRealProperty(WarpXParIter& pti, auto& currRecord = currSpecies[record_name]; auto& currRecordComp = currRecord[component_name]; - // meta data for ED-PIC extension - bool newRecord = false; - std::tie(std::ignore, newRecord) = addedRecords.insert(record_name); - if( newRecord ) { - currRecord.setAttribute( "macroWeighted", 0u ); - if( record_name == "momentum" ) - currRecord.setAttribute( "weightingPower", 1.0 ); - else - currRecord.setAttribute( "weightingPower", 0.0 ); - currRecord.setUnitDimension( detail::getUnitDimension(record_name) ); - } - currRecordComp.storeChunk(openPMD::shareRaw(soa.GetRealData(idx)), - {offset}, {static_cast<unsigned long long>(numParticleOnTile)}); + {offset}, {numParticleOnTile64}); } } - m_Series->flush(); } } @@ -505,8 +532,7 @@ WarpXOpenPMDPlot::WriteOpenPMDFields( //const std::string& filename, //This is AMReX's tiny profiler. Possibly will apply it later BL_PROFILE("WarpXOpenPMDPlot::WriteOpenPMDFields()"); - if ( nullptr == m_Series) - return; + AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_Series != nullptr, "openPMD series must be initialized"); int const ncomp = mf.nComp(); @@ -692,13 +718,14 @@ WarpXParticleCounter::WarpXParticleCounter(const std::unique_ptr<WarpXParticleCo // get the offset in the overall particle id collection // +// note: this is a MPI-collective operation +// // input: num of particles of from each processor // // output: // offset within <all> the particles in the comm // sum of all particles in the comm // - void WarpXParticleCounter::GetParticleOffsetOfProcessor(const long& numParticles, unsigned long long& offset, diff --git a/Source/Diagnostics/requirements.txt b/Source/Diagnostics/requirements.txt index 2c29c7422..5a3933299 100644 --- a/Source/Diagnostics/requirements.txt +++ b/Source/Diagnostics/requirements.txt @@ -1,2 +1,8 @@ +# Copyright 2020 Axel Huebl +# +# This file is part of WarpX. +# +# License: BSD-3-Clause-LBNL + # keep this entry for GitHub's dependency graph openPMD-api>=0.10.3 diff --git a/Source/Evolve/WarpXDtType.H b/Source/Evolve/WarpXDtType.H index c2c01db00..89fcb506f 100644 --- a/Source/Evolve/WarpXDtType.H +++ b/Source/Evolve/WarpXDtType.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_DTTYPE_H_ #define WARPX_DTTYPE_H_ diff --git a/Source/Evolve/WarpXEvolveEM.cpp b/Source/Evolve/WarpXEvolveEM.cpp index 1cb17287b..bb1300562 100644 --- a/Source/Evolve/WarpXEvolveEM.cpp +++ b/Source/Evolve/WarpXEvolveEM.cpp @@ -1,3 +1,13 @@ +/* Copyright 2019-2020 Andrew Myers, Ann Almgren, Aurore Blelly + * Axel Huebl, Burlen Loring, David Grote + * Glenn Richardson, Jean-Luc Vay, Luca Fedeli + * Maxence Thevenet, Remi Lehe, Revathi Jambunathan + * Weiqun Zhang, Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <cmath> #include <limits> @@ -14,7 +24,6 @@ #include <AMReX_AmrMeshInSituBridge.H> #endif - using namespace amrex; void @@ -146,7 +155,8 @@ WarpX::EvolveEM (int numsteps) cur_time += dt[0]; - bool to_make_plot = (plot_int > 0) && ((step+1) % plot_int == 0); + bool to_make_plot = ( (plot_int > 0) && ((step+1) % plot_int == 0) ); + bool to_write_openPMD = ( (openpmd_int > 0) && ((step+1) % openpmd_int == 0) ); // slice generation // bool to_make_slice_plot = (slice_plot_int > 0) && ( (step+1)% slice_plot_int == 0); @@ -162,7 +172,7 @@ WarpX::EvolveEM (int numsteps) myBFD->writeLabFrameData(cell_centered_data.get(), *mypc, geom[0], cur_time, dt[0]); } - bool move_j = is_synchronized || to_make_plot || do_insitu; + bool move_j = is_synchronized || to_make_plot || to_write_openPMD || do_insitu; // If is_synchronized we need to shift j too so that next step we can evolve E by dt/2. // We might need to move j because we are going to make a plotfile. @@ -195,8 +205,15 @@ WarpX::EvolveEM (int numsteps) t_new[i] = cur_time; } + /// reduced diags + if (reduced_diags->m_plot_rd != 0) + { + reduced_diags->ComputeDiags(step); + reduced_diags->WriteToFile(step); + } + // slice gen // - if (to_make_plot || do_insitu || to_make_slice_plot) + if (to_make_plot || to_write_openPMD || do_insitu || to_make_slice_plot) { // This is probably overkill, but it's not called often FillBoundaryE(guard_cells.ng_alloc_EB, guard_cells.ng_Extra); @@ -219,6 +236,8 @@ WarpX::EvolveEM (int numsteps) if (to_make_plot) WritePlotFile(); + if (to_write_openPMD) + WriteOpenPMDFile(); if (to_make_slice_plot) { @@ -250,11 +269,12 @@ WarpX::EvolveEM (int numsteps) bool write_plot_file = plot_int > 0 && istep[0] > last_plot_file_step && (max_time_reached || istep[0] >= max_step); + bool write_openPMD = openpmd_int > 0 && (max_time_reached || istep[0] >= max_step); bool do_insitu = (insitu_start >= istep[0]) && (insitu_int > 0) && (istep[0] > last_insitu_step) && (max_time_reached || istep[0] >= max_step); - if (write_plot_file || do_insitu) + if (write_plot_file || write_openPMD || do_insitu) { // This is probably overkill, but it's not called often FillBoundaryE(guard_cells.ng_alloc_EB, guard_cells.ng_Extra); @@ -276,6 +296,8 @@ WarpX::EvolveEM (int numsteps) if (write_plot_file) WritePlotFile(); + if (write_openPMD) + WriteOpenPMDFile(); if (do_insitu) UpdateInSitu(); diff --git a/Source/Evolve/WarpXEvolveES.cpp b/Source/Evolve/WarpXEvolveES.cpp index 555ab37ad..77e037154 100644 --- a/Source/Evolve/WarpXEvolveES.cpp +++ b/Source/Evolve/WarpXEvolveES.cpp @@ -1,3 +1,11 @@ +/* Copyright 2019 Andrew Myers, Axel Huebl, David Bizzozero + * David Grote, Maxence Thevenet, Remi Lehe + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <WarpX_f.H> @@ -58,7 +66,7 @@ WarpX::EvolveES (int numsteps) { // Beyond one step, particles have p^{n-1/2} and x^{n}. if (is_synchronized) { // on first step, push X by 0.5*dt - mypc->PushXES(0.5*dt[lev]); + mypc->PushX(0.5*dt[lev]); UpdatePlasmaInjectionPosition(0.5*dt[lev]); mypc->Redistribute(); mypc->DepositCharge(rhoNodal); @@ -95,7 +103,7 @@ WarpX::EvolveES (int numsteps) { if (cur_time + dt[0] >= stop_time - 1.e-3*dt[0] || step == numsteps_max-1) { // on last step, push by only 0.5*dt to synchronize all at n+1/2 - mypc->PushXES(-0.5*dt[lev]); + mypc->PushX(-0.5*dt[lev]); UpdatePlasmaInjectionPosition(-0.5*dt[lev]); is_synchronized = true; } diff --git a/Source/FieldSolver/PicsarHybridSpectralSolver/PicsarHybridFFTData.H b/Source/FieldSolver/PicsarHybridSpectralSolver/PicsarHybridFFTData.H index 4e97ab675..44bb42982 100644 --- a/Source/FieldSolver/PicsarHybridSpectralSolver/PicsarHybridFFTData.H +++ b/Source/FieldSolver/PicsarHybridSpectralSolver/PicsarHybridFFTData.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PICSAR_HYBRID_FFTDATA_H_ #define WARPX_PICSAR_HYBRID_FFTDATA_H_ diff --git a/Source/FieldSolver/PicsarHybridSpectralSolver/PicsarHybridSpectralSolver.cpp b/Source/FieldSolver/PicsarHybridSpectralSolver/PicsarHybridSpectralSolver.cpp index 6b7a34271..5b7d95775 100644 --- a/Source/FieldSolver/PicsarHybridSpectralSolver/PicsarHybridSpectralSolver.cpp +++ b/Source/FieldSolver/PicsarHybridSpectralSolver/PicsarHybridSpectralSolver.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019 Axel Huebl, Maxence Thevenet, Remi Lehe + * Revathi Jambunathan, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <WarpX_f.H> diff --git a/Source/FieldSolver/PicsarHybridSpectralSolver/picsar_hybrid_spectral.F90 b/Source/FieldSolver/PicsarHybridSpectralSolver/picsar_hybrid_spectral.F90 index 35357a63f..96bfb6111 100644 --- a/Source/FieldSolver/PicsarHybridSpectralSolver/picsar_hybrid_spectral.F90 +++ b/Source/FieldSolver/PicsarHybridSpectralSolver/picsar_hybrid_spectral.F90 @@ -1,3 +1,10 @@ +! Copyright 2019 Andrew Myers, Maxence Thevenet, Remi Lehe +! Weiqun Zhang +! +! This file is part of WarpX. +! +! License: BSD-3-Clause-LBNL + module warpx_fft_module use amrex_error_module, only : amrex_error, amrex_abort diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.H index 80ceb2e93..4452002d1 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Axel Huebl, Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PML_PSATD_ALGORITHM_H_ #define WARPX_PML_PSATD_ALGORITHM_H_ diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.cpp index d76259d4c..bae74daf6 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PMLPsatdAlgorithm.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <PMLPsatdAlgorithm.H> #include <WarpXConst.H> #include <cmath> diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H index b7aed9e40..4abe89d9d 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Maxence Thevenet, Remi Lehe, Revathi Jambunathan + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PSATD_ALGORITHM_H_ #define WARPX_PSATD_ALGORITHM_H_ diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp index d45b01bda..4f4963e95 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithm.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Remi Lehe, Revathi Jambunathan + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <PsatdAlgorithm.H> #include <WarpXConst.H> #include <cmath> diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H index 5d5e376c1..2c4946190 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/SpectralBaseAlgorithm.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_SPECTRAL_BASE_ALGORITHM_H_ #define WARPX_SPECTRAL_BASE_ALGORITHM_H_ diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.H b/Source/FieldSolver/SpectralSolver/SpectralFieldData.H index dc83d279d..e66a9ce50 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralFieldData.H +++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.H @@ -1,3 +1,10 @@ +/* Copyright 2019 David Grote, Maxence Thevenet, Remi Lehe + * Revathi Jambunathan + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_SPECTRAL_FIELD_DATA_H_ #define WARPX_SPECTRAL_FIELD_DATA_H_ diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp index edd4df34d..81e2b0907 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019 Maxence Thevenet, Remi Lehe, Revathi Jambunathan + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <SpectralFieldData.H> using namespace amrex; diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H index eb07e8fe6..c8b4f49eb 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.H +++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.H @@ -1,3 +1,10 @@ +/* Copyright 2019 David Grote, Maxence Thevenet, Remi Lehe + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_SPECTRAL_K_SPACE_H_ #define WARPX_SPECTRAL_K_SPACE_H_ diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp index c21388aba..d0355fc1e 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019-2020 Andrew Myers, Maxence Thevenet, Remi Lehe + * Revathi Jambunathan + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpXConst.H> #include <SpectralKSpace.H> #include <cmath> diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.H b/Source/FieldSolver/SpectralSolver/SpectralSolver.H index bd92d003f..a6375e483 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolver.H +++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.H @@ -1,3 +1,9 @@ +/* Copyright 2019-2020 Maxence Thevenet, Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_SPECTRAL_SOLVER_H_ #define WARPX_SPECTRAL_SOLVER_H_ diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp index 4b9def013..ca7bd06a0 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <SpectralKSpace.H> #include <SpectralSolver.H> #include <PsatdAlgorithm.H> diff --git a/Source/FieldSolver/SpectralSolver/WarpX_ComplexForFFT.H b/Source/FieldSolver/SpectralSolver/WarpX_ComplexForFFT.H index 43c7a1950..f75c9b19a 100644 --- a/Source/FieldSolver/SpectralSolver/WarpX_ComplexForFFT.H +++ b/Source/FieldSolver/SpectralSolver/WarpX_ComplexForFFT.H @@ -1,3 +1,9 @@ +/* Copyright 2019 David Grote + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_COMPLEXFORFFT_H_ #define WARPX_COMPLEXFORFFT_H_ diff --git a/Source/FieldSolver/WarpXPushFieldsEM.cpp b/Source/FieldSolver/WarpXPushFieldsEM.cpp index 4848b051e..1e922ecd3 100644 --- a/Source/FieldSolver/WarpXPushFieldsEM.cpp +++ b/Source/FieldSolver/WarpXPushFieldsEM.cpp @@ -1,3 +1,11 @@ +/* Copyright 2019 Andrew Myers, Aurore Blelly, Axel Huebl + * David Grote, Maxence Thevenet, Remi Lehe + * Revathi Jambunathan, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <cmath> #include <limits> diff --git a/Source/FieldSolver/WarpX_FDTD.H b/Source/FieldSolver/WarpX_FDTD.H index b93c0f40a..4ad251264 100644 --- a/Source/FieldSolver/WarpX_FDTD.H +++ b/Source/FieldSolver/WarpX_FDTD.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Axel Huebl, David Grote + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_FDTD_H_ #define WARPX_FDTD_H_ diff --git a/Source/FieldSolver/WarpX_K.H b/Source/FieldSolver/WarpX_K.H index f61a71e21..a4f657909 100644 --- a/Source/FieldSolver/WarpX_K.H +++ b/Source/FieldSolver/WarpX_K.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Axel Huebl, Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_K_H_ #define WARPX_K_H_ diff --git a/Source/Filter/BilinearFilter.H b/Source/Filter/BilinearFilter.H index 150ca8e08..f5405946b 100644 --- a/Source/Filter/BilinearFilter.H +++ b/Source/Filter/BilinearFilter.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Andrew Myers, Maxence Thevenet, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <Filter.H> #ifndef WARPX_BILIN_FILTER_H_ diff --git a/Source/Filter/BilinearFilter.cpp b/Source/Filter/BilinearFilter.cpp index 23abaf8bc..fd9153316 100644 --- a/Source/Filter/BilinearFilter.cpp +++ b/Source/Filter/BilinearFilter.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019 Andrew Myers, Maxence Thevenet, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <BilinearFilter.H> #include <WarpX_f.H> diff --git a/Source/Filter/Filter.H b/Source/Filter/Filter.H index 1ecb1bff4..4e36a1f1f 100644 --- a/Source/Filter/Filter.H +++ b/Source/Filter/Filter.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Maxence Thevenet, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <AMReX_MultiFab.H> #ifndef WARPX_FILTER_H_ diff --git a/Source/Filter/Filter.cpp b/Source/Filter/Filter.cpp index 93729a0ae..dbe13747e 100644 --- a/Source/Filter/Filter.cpp +++ b/Source/Filter/Filter.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019 Andrew Myers, Maxence Thevenet, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <Filter.H> diff --git a/Source/Filter/NCIGodfreyFilter.H b/Source/Filter/NCIGodfreyFilter.H index de41de7ae..c174422c4 100644 --- a/Source/Filter/NCIGodfreyFilter.H +++ b/Source/Filter/NCIGodfreyFilter.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <Filter.H> #ifndef WARPX_GODFREY_FILTER_H_ diff --git a/Source/Filter/NCIGodfreyFilter.cpp b/Source/Filter/NCIGodfreyFilter.cpp index 41ae67768..1a400cb32 100644 --- a/Source/Filter/NCIGodfreyFilter.cpp +++ b/Source/Filter/NCIGodfreyFilter.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019-2020 Luca Fedeli, Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <NCIGodfreyFilter.H> #include <NCIGodfreyTables.H> diff --git a/Source/FortranInterface/WarpX_f.F90 b/Source/FortranInterface/WarpX_f.F90 index 762ed2cd8..71b1ae9fa 100644 --- a/Source/FortranInterface/WarpX_f.F90 +++ b/Source/FortranInterface/WarpX_f.F90 @@ -1,3 +1,11 @@ +! Copyright 2019 Andrew Myers, Axel Huebl, David Grote +! Ligia Diana Amorim, Mathieu Lobet, Maxence Thevenet +! Remi Lehe, Weiqun Zhang +! +! This file is part of WarpX. +! +! License: BSD-3-Clause-LBNL + module warpx_module @@ -8,49 +16,6 @@ module warpx_module contains - subroutine warpx_compute_E (lo, hi, & - phi, phlo, phhi, & - Ex, Exlo, Exhi, & - Ey, Eylo, Eyhi, & - Ez, Ezlo, Ezhi, & - dx) bind(c,name='warpx_compute_E') - integer(c_int), intent(in) :: lo(3), hi(3), phlo(3), phhi(3), Exlo(3), Exhi(3), & - Eylo(3), Eyhi(3), Ezlo(3), Ezhi(3) - real(amrex_real), intent(in) :: dx(3) - real(amrex_real), intent(in ) :: phi(phlo(1):phhi(1),phlo(2):phhi(2),phlo(3):phhi(3)) - real(amrex_real), intent(inout) :: Ex (Exlo(1):Exhi(1),Exlo(2):Exhi(2),Exlo(3):Exhi(3)) - real(amrex_real), intent(inout) :: Ey (Eylo(1):Eyhi(1),Eylo(2):Eyhi(2),Eylo(3):Eyhi(3)) - real(amrex_real), intent(inout) :: Ez (Ezlo(1):Ezhi(1),Ezlo(2):Ezhi(2),Ezlo(3):Ezhi(3)) - - integer :: i, j, k - real(amrex_real) :: dxinv(3) - - dxinv = 1.0 / dx - - do k = lo(3), hi(3) - do j = lo(2), hi(2) - - do i = lo(1), hi(1)-1 - Ex(i,j,k) = dxinv(1) * (phi(i,j,k) - phi(i+1,j,k)) - end do - - if (j < hi(2)) then - do i = lo(1), hi(1) - Ey(i,j,k) = dxinv(2) * (phi(i,j,k) - phi(i,j+1,k)) - end do - end if - - if (k < hi(3)) then - do i = lo(1), hi(1) - Ez(i,j,k) = dxinv(3) * (phi(i,j,k) - phi(i,j,k+1)) - end do - end if - - end do - end do - - end subroutine warpx_compute_E - subroutine warpx_build_buffer_masks (lo, hi, msk, mlo, mhi, gmsk, glo, ghi, ng) & bind(c, name='warpx_build_buffer_masks') integer, dimension(3), intent(in) :: lo, hi, mlo, mhi, glo, ghi diff --git a/Source/FortranInterface/WarpX_f.H b/Source/FortranInterface/WarpX_f.H index 48aaac275..74fd9f379 100644 --- a/Source/FortranInterface/WarpX_f.H +++ b/Source/FortranInterface/WarpX_f.H @@ -1,3 +1,13 @@ +/* Copyright 2019 Andrew Myers, Aurore Blelly, Axel Huebl + * David Grote, Jean-Luc Vay, Ligia Diana Amorim + * Luca Fedeli, Mathieu Lobet, Maxence Thevenet + * Remi Lehe, Revathi Jambunathan, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_F_H_ #define WARPX_F_H_ @@ -24,7 +34,6 @@ #define WRPX_INTERPOLATE_CIC warpx_interpolate_cic_3d #define WRPX_INTERPOLATE_CIC_TWO_LEVELS warpx_interpolate_cic_two_levels_3d #define WRPX_PUSH_LEAPFROG warpx_push_leapfrog_3d -#define WRPX_PUSH_LEAPFROG_POSITIONS warpx_push_leapfrog_positions_3d #elif (AMREX_SPACEDIM == 2) @@ -33,7 +42,6 @@ #define WRPX_INTERPOLATE_CIC warpx_interpolate_cic_2d #define WRPX_INTERPOLATE_CIC_TWO_LEVELS warpx_interpolate_cic_two_levels_2d #define WRPX_PUSH_LEAPFROG warpx_push_leapfrog_2d -#define WRPX_PUSH_LEAPFROG_POSITIONS warpx_push_leapfrog_positions_2d #endif diff --git a/Source/Initialization/CustomDensityProb.H b/Source/Initialization/CustomDensityProb.H index c5c159ee8..804b56ce8 100644 --- a/Source/Initialization/CustomDensityProb.H +++ b/Source/Initialization/CustomDensityProb.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Maxence Thevenet, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef CUSTOM_DENSITY_PROB_H_ #define CUSTOM_DENSITY_PROB_H_ diff --git a/Source/Initialization/CustomMomentumProb.H b/Source/Initialization/CustomMomentumProb.H index f8bc29a05..0b4d531c7 100644 --- a/Source/Initialization/CustomMomentumProb.H +++ b/Source/Initialization/CustomMomentumProb.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Maxence Thevenet, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef CUSTOM_MOMENTUM_PROB_H #define CUSTOM_MOMENTUM_PROB_H diff --git a/Source/Initialization/InitSpaceChargeField.cpp b/Source/Initialization/InitSpaceChargeField.cpp index 0a873b742..36914d2c6 100644 --- a/Source/Initialization/InitSpaceChargeField.cpp +++ b/Source/Initialization/InitSpaceChargeField.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <AMReX_ParallelDescriptor.H> #include <AMReX_MLMG.H> diff --git a/Source/Initialization/InjectorDensity.H b/Source/Initialization/InjectorDensity.H index 7e61ae27d..4558eeb96 100644 --- a/Source/Initialization/InjectorDensity.H +++ b/Source/Initialization/InjectorDensity.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Axel Huebl, Maxence Thevenet, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef INJECTOR_DENSITY_H_ #define INJECTOR_DENSITY_H_ diff --git a/Source/Initialization/InjectorDensity.cpp b/Source/Initialization/InjectorDensity.cpp index fa54b342c..f59202db9 100644 --- a/Source/Initialization/InjectorDensity.cpp +++ b/Source/Initialization/InjectorDensity.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019-2020 Axel Huebl, Ligia Diana Amorim, Maxence Thevenet + * Revathi Jambunathan, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <InjectorDensity.H> #include <PlasmaInjector.H> diff --git a/Source/Initialization/InjectorMomentum.H b/Source/Initialization/InjectorMomentum.H index 88c954df6..bb5a70784 100644 --- a/Source/Initialization/InjectorMomentum.H +++ b/Source/Initialization/InjectorMomentum.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Axel Huebl, Cameron Yang, Maxence Thevenet + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef INJECTOR_MOMENTUM_H_ #define INJECTOR_MOMENTUM_H_ diff --git a/Source/Initialization/InjectorMomentum.cpp b/Source/Initialization/InjectorMomentum.cpp index 255883a34..edbba8ac5 100644 --- a/Source/Initialization/InjectorMomentum.cpp +++ b/Source/Initialization/InjectorMomentum.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019-2020 Axel Huebl, Maxence Thevenet, Revathi Jambunathan + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <InjectorMomentum.H> #include <PlasmaInjector.H> diff --git a/Source/Initialization/InjectorPosition.H b/Source/Initialization/InjectorPosition.H index 4ab2fa022..a8d2200e9 100644 --- a/Source/Initialization/InjectorPosition.H +++ b/Source/Initialization/InjectorPosition.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Axel Huebl, David Grote, Maxence Thevenet + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef INJECTOR_POSITION_H_ #define INJECTOR_POSITION_H_ diff --git a/Source/Initialization/PlasmaInjector.H b/Source/Initialization/PlasmaInjector.H index 56b32c827..70d99b9a3 100644 --- a/Source/Initialization/PlasmaInjector.H +++ b/Source/Initialization/PlasmaInjector.H @@ -1,3 +1,11 @@ +/* Copyright 2019 Andrew Myers, Axel Huebl, David Grote + * Maxence Thevenet, Remi Lehe, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef PLASMA_INJECTOR_H_ #define PLASMA_INJECTOR_H_ diff --git a/Source/Initialization/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp index 5f75ed45a..96e82d749 100644 --- a/Source/Initialization/PlasmaInjector.cpp +++ b/Source/Initialization/PlasmaInjector.cpp @@ -1,3 +1,12 @@ +/* Copyright 2019-2020 Andrew Myers, Axel Huebl, Cameron Yang + * David Grote, Luca Fedeli, Maxence Thevenet + * Remi Lehe, Revathi Jambunathan, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include "PlasmaInjector.H" #include <WarpXConst.H> diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 48c30ae93..8b2fe1831 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -1,3 +1,12 @@ +/* Copyright 2019-2020 Andrew Myers, Ann Almgren, Aurore Blelly + * Axel Huebl, Burlen Loring, Maxence Thevenet + * Remi Lehe, Revathi Jambunathan, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <WarpX_f.H> #include <BilinearFilter.H> @@ -74,11 +83,21 @@ WarpX::InitData () if (plot_int > 0) WritePlotFile(); + if (openpmd_int > 0) + WriteOpenPMDFile(); + if (check_int > 0) WriteCheckPointFile(); if ((insitu_int > 0) && (insitu_start == 0)) UpdateInSitu(); + + // Write reduced diagnostics before the first iteration. + if (reduced_diags->m_plot_rd != 0) + { + reduced_diags->ComputeDiags(-1); + reduced_diags->WriteToFile(-1); + } } } diff --git a/Source/Laser/LaserParticleContainer.H b/Source/Laser/LaserParticleContainer.H index ada899d2d..80d5e7f16 100644 --- a/Source/Laser/LaserParticleContainer.H +++ b/Source/Laser/LaserParticleContainer.H @@ -1,3 +1,11 @@ +/* Copyright 2019 Andrew Myers, Axel Huebl, David Grote + * Luca Fedeli, Maxence Thevenet, Remi Lehe + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_LaserParticleContainer_H_ #define WARPX_LaserParticleContainer_H_ diff --git a/Source/Laser/LaserParticleContainer.cpp b/Source/Laser/LaserParticleContainer.cpp index 09dd8814b..2bc522a8e 100644 --- a/Source/Laser/LaserParticleContainer.cpp +++ b/Source/Laser/LaserParticleContainer.cpp @@ -1,3 +1,11 @@ +/* Copyright 2019-2020 Andrew Myers, Axel Huebl, David Grote + * Luca Fedeli, Maxence Thevenet, Remi Lehe + * Revathi Jambunathan, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <limits> #include <cmath> #include <algorithm> diff --git a/Source/Laser/LaserProfiles.H b/Source/Laser/LaserProfiles.H index f97bf915e..94cfae090 100644 --- a/Source/Laser/LaserProfiles.H +++ b/Source/Laser/LaserProfiles.H @@ -1,3 +1,9 @@ +/* Copyright 2019-2020 Luca Fedeli, Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_LaserProfiles_H_ #define WARPX_LaserProfiles_H_ diff --git a/Source/Laser/LaserProfilesImpl/LaserProfileFieldFunction.cpp b/Source/Laser/LaserProfilesImpl/LaserProfileFieldFunction.cpp index d34bc6aba..66660d6be 100644 --- a/Source/Laser/LaserProfilesImpl/LaserProfileFieldFunction.cpp +++ b/Source/Laser/LaserProfilesImpl/LaserProfileFieldFunction.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <LaserProfiles.H> #include <WarpX_Complex.H> diff --git a/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp b/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp index 8f44c2d5f..114464dbf 100644 --- a/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp +++ b/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019-2020 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <LaserProfiles.H> #include <WarpX_Complex.H> diff --git a/Source/Laser/LaserProfilesImpl/LaserProfileGaussian.cpp b/Source/Laser/LaserProfilesImpl/LaserProfileGaussian.cpp index 18bdec4a7..31e64eca5 100644 --- a/Source/Laser/LaserProfilesImpl/LaserProfileGaussian.cpp +++ b/Source/Laser/LaserProfilesImpl/LaserProfileGaussian.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019 Axel Huebl, Luca Fedeli, Maxence Thevenet + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <LaserProfiles.H> #include <WarpX_Complex.H> diff --git a/Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp b/Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp index 7fe75cf56..de4879939 100644 --- a/Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp +++ b/Source/Laser/LaserProfilesImpl/LaserProfileHarris.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <LaserProfiles.H> #include <WarpX_Complex.H> diff --git a/Source/Parallelization/GuardCellManager.H b/Source/Parallelization/GuardCellManager.H index c57745b84..ef7738178 100644 --- a/Source/Parallelization/GuardCellManager.H +++ b/Source/Parallelization/GuardCellManager.H @@ -1,3 +1,9 @@ +/* Copyright 2019-2020 Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef GUARDCELLMANAGER_H_ #define GUARDCELLMANAGER_H_ diff --git a/Source/Parallelization/GuardCellManager.cpp b/Source/Parallelization/GuardCellManager.cpp index a275f4c00..d845a7447 100644 --- a/Source/Parallelization/GuardCellManager.cpp +++ b/Source/Parallelization/GuardCellManager.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019-2020 Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include "GuardCellManager.H" #include "NCIGodfreyFilter.H" #include <AMReX_Print.H> diff --git a/Source/Parallelization/InterpolateCurrentFineToCoarse.H b/Source/Parallelization/InterpolateCurrentFineToCoarse.H index 58451c6b7..43cda26df 100644 --- a/Source/Parallelization/InterpolateCurrentFineToCoarse.H +++ b/Source/Parallelization/InterpolateCurrentFineToCoarse.H @@ -1,4 +1,4 @@ -/* Copyright 2019 Axel Huebl, Weiqun Zhang +/* Copyright 2019-2020 Axel Huebl * * This file is part of WarpX. * diff --git a/Source/Parallelization/InterpolateDensityFineToCoarse.H b/Source/Parallelization/InterpolateDensityFineToCoarse.H index 947db2aac..5d679583a 100644 --- a/Source/Parallelization/InterpolateDensityFineToCoarse.H +++ b/Source/Parallelization/InterpolateDensityFineToCoarse.H @@ -1,4 +1,4 @@ -/* Copyright 2019 Axel Huebl, Weiqun Zhang +/* Copyright 2019 Axel Huebl * * This file is part of WarpX. * diff --git a/Source/Parallelization/WarpXComm.H b/Source/Parallelization/WarpXComm.H index 81f00088e..7352e797e 100644 --- a/Source/Parallelization/WarpXComm.H +++ b/Source/Parallelization/WarpXComm.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARALLELIZATION_COMM_H_ #define WARPX_PARALLELIZATION_COMM_H_ diff --git a/Source/Parallelization/WarpXComm.cpp b/Source/Parallelization/WarpXComm.cpp index 2e0cbdfad..31bb802f7 100644 --- a/Source/Parallelization/WarpXComm.cpp +++ b/Source/Parallelization/WarpXComm.cpp @@ -1,3 +1,11 @@ +/* Copyright 2019 Andrew Myers, Aurore Blelly, Axel Huebl + * David Grote, Maxence Thevenet, Remi Lehe + * Revathi Jambunathan, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpXComm.H> #include <WarpXComm_K.H> #include <WarpX.H> diff --git a/Source/Parallelization/WarpXComm_K.H b/Source/Parallelization/WarpXComm_K.H index 169cd0ee1..1b6eceb93 100644 --- a/Source/Parallelization/WarpXComm_K.H +++ b/Source/Parallelization/WarpXComm_K.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Axel Huebl, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_COMM_K_H_ #define WARPX_COMM_K_H_ diff --git a/Source/Parallelization/WarpXRegrid.cpp b/Source/Parallelization/WarpXRegrid.cpp index 29ccc8f4d..54166e8ce 100644 --- a/Source/Parallelization/WarpXRegrid.cpp +++ b/Source/Parallelization/WarpXRegrid.cpp @@ -1,3 +1,11 @@ +/* Copyright 2019 Andrew Myers, Ann Almgren, Axel Huebl + * David Grote, Maxence Thevenet, Remi Lehe + * Weiqun Zhang, levinem + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <AMReX_BLProfiler.H> diff --git a/Source/Parallelization/WarpXSumGuardCells.H b/Source/Parallelization/WarpXSumGuardCells.H index 36eb4ed6c..972c1cd2d 100644 --- a/Source/Parallelization/WarpXSumGuardCells.H +++ b/Source/Parallelization/WarpXSumGuardCells.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Maxence Thevenet, Remi Lehe, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_SUM_GUARD_CELLS_H_ #define WARPX_SUM_GUARD_CELLS_H_ diff --git a/Source/Parser/GpuParser.H b/Source/Parser/GpuParser.H index ff855d275..c6d870800 100644 --- a/Source/Parser/GpuParser.H +++ b/Source/Parser/GpuParser.H @@ -1,3 +1,10 @@ +/* Copyright 2019-2020 Maxence Thevenet, Revathi Jambunathan, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_GPU_PARSER_H_ #define WARPX_GPU_PARSER_H_ diff --git a/Source/Parser/GpuParser.cpp b/Source/Parser/GpuParser.cpp index ba904666b..22fab6313 100644 --- a/Source/Parser/GpuParser.cpp +++ b/Source/Parser/GpuParser.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019-2020 Maxence Thevenet, Revathi Jambunathan, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <GpuParser.H> GpuParser::GpuParser (WarpXParser const& wp) diff --git a/Source/Parser/WarpXParser.H b/Source/Parser/WarpXParser.H index 8c1d854d8..863b35fb8 100644 --- a/Source/Parser/WarpXParser.H +++ b/Source/Parser/WarpXParser.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARSER_H_ #define WARPX_PARSER_H_ diff --git a/Source/Parser/WarpXParser.cpp b/Source/Parser/WarpXParser.cpp index ced536327..8c8be7ecb 100644 --- a/Source/Parser/WarpXParser.cpp +++ b/Source/Parser/WarpXParser.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <algorithm> #include "WarpXParser.H" diff --git a/Source/Parser/WarpXParserWrapper.H b/Source/Parser/WarpXParserWrapper.H index 2a4ff6fd2..2c76d97a3 100644 --- a/Source/Parser/WarpXParserWrapper.H +++ b/Source/Parser/WarpXParserWrapper.H @@ -1,3 +1,9 @@ +/* Copyright 2020 Revathi Jambunathan + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARSER_WRAPPER_H_ #define WARPX_PARSER_WRAPPER_H_ @@ -26,7 +32,7 @@ struct ParserWrapper amrex::Real getField (amrex::Real x, amrex::Real y, amrex::Real z, amrex::Real t=0.0) const noexcept { - return m_parser(x,y,z); + return m_parser(x,y,z,t); } GpuParser m_parser; diff --git a/Source/Particles/Collision/CollisionType.H b/Source/Particles/Collision/CollisionType.H index d020f47e8..29fdfb029 100644 --- a/Source/Particles/Collision/CollisionType.H +++ b/Source/Particles/Collision/CollisionType.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_COLLISION_COLLISIONTYPE_H_ #define WARPX_PARTICLES_COLLISION_COLLISIONTYPE_H_ diff --git a/Source/Particles/Collision/CollisionType.cpp b/Source/Particles/Collision/CollisionType.cpp index b8014579d..1d384ed8c 100644 --- a/Source/Particles/Collision/CollisionType.cpp +++ b/Source/Particles/Collision/CollisionType.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include "CollisionType.H" #include "ShuffleFisherYates.H" #include "ElasticCollisionPerez.H" @@ -8,11 +14,9 @@ CollisionType::CollisionType( std::string const collision_name) { -#if defined WARPX_DIM_XZ - amrex::Abort("Collisions only work in 3D geometry for now."); -#elif defined WARPX_DIM_RZ + #if defined WARPX_DIM_RZ amrex::Abort("Collisions only work in Cartesian geometry for now."); -#endif + #endif // read collision species std::vector<std::string> collision_species; @@ -66,7 +70,7 @@ namespace { const auto dxi = geom.InvCellSizeArray(); const auto plo = geom.ProbLoArray(); - // Find particles that are in each cell ; + // Find particles that are in each cell; // results are stored in the object `bins`. ParticleBins bins; bins.build(np, particle_ptr, cbx, @@ -128,7 +132,11 @@ void CollisionType::doCoulombCollisionsWithinTile const Real dt = WarpX::GetInstance().getdt(lev); Geometry const& geom = WarpX::GetInstance().Geom(lev); - const Real dV = geom.CellSize(0)*geom.CellSize(1)*geom.CellSize(2); + #if (AMREX_SPACEDIM == 2) + auto dV = geom.CellSize(0) * geom.CellSize(1); + #elif (AMREX_SPACEDIM == 3) + auto dV = geom.CellSize(0) * geom.CellSize(1) * geom.CellSize(2); + #endif // Loop over cells amrex::ParallelFor( n_cells, @@ -200,7 +208,11 @@ void CollisionType::doCoulombCollisionsWithinTile const Real dt = WarpX::GetInstance().getdt(lev); Geometry const& geom = WarpX::GetInstance().Geom(lev); - const Real dV = geom.CellSize(0)*geom.CellSize(1)*geom.CellSize(2); + #if (AMREX_SPACEDIM == 2) + auto dV = geom.CellSize(0) * geom.CellSize(1); + #elif (AMREX_SPACEDIM == 3) + auto dV = geom.CellSize(0) * geom.CellSize(1) * geom.CellSize(2); + #endif // Loop over cells amrex::ParallelFor( n_cells, diff --git a/Source/Particles/Collision/ComputeTemperature.H b/Source/Particles/Collision/ComputeTemperature.H index 770510d74..81cb14dad 100644 --- a/Source/Particles/Collision/ComputeTemperature.H +++ b/Source/Particles/Collision/ComputeTemperature.H @@ -1,3 +1,9 @@ +/* Copyright 2019-2020 Andrew Myers, Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_COLLISION_COMPUTE_TEMPERATURE_H_ #define WARPX_PARTICLES_COLLISION_COMPUTE_TEMPERATURE_H_ diff --git a/Source/Particles/Collision/ElasticCollisionPerez.H b/Source/Particles/Collision/ElasticCollisionPerez.H index 8e16d95cc..b1fa64300 100644 --- a/Source/Particles/Collision/ElasticCollisionPerez.H +++ b/Source/Particles/Collision/ElasticCollisionPerez.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_COLLISION_ELASTIC_COLLISION_PEREZ_H_ #define WARPX_PARTICLES_COLLISION_ELASTIC_COLLISION_PEREZ_H_ diff --git a/Source/Particles/Collision/ShuffleFisherYates.H b/Source/Particles/Collision/ShuffleFisherYates.H index 621e654d6..614b44d37 100644 --- a/Source/Particles/Collision/ShuffleFisherYates.H +++ b/Source/Particles/Collision/ShuffleFisherYates.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_COLLISION_SHUFFLE_FISHER_YATES_H_ #define WARPX_PARTICLES_COLLISION_SHUFFLE_FISHER_YATES_H_ diff --git a/Source/Particles/Collision/UpdateMomentumPerezElastic.H b/Source/Particles/Collision/UpdateMomentumPerezElastic.H index 948e8b075..05c8cd227 100644 --- a/Source/Particles/Collision/UpdateMomentumPerezElastic.H +++ b/Source/Particles/Collision/UpdateMomentumPerezElastic.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_COLLISION_UPDATE_MOMENTUM_PEREZ_ELASTIC_H_ #define WARPX_PARTICLES_COLLISION_UPDATE_MOMENTUM_PEREZ_ELASTIC_H_ diff --git a/Source/Particles/Deposition/ChargeDeposition.H b/Source/Particles/Deposition/ChargeDeposition.H index f1d737994..b03e4224f 100755 --- a/Source/Particles/Deposition/ChargeDeposition.H +++ b/Source/Particles/Deposition/ChargeDeposition.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Axel Huebl, David Grote, Maxence Thevenet + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef CHARGEDEPOSITION_H_ #define CHARGEDEPOSITION_H_ diff --git a/Source/Particles/Deposition/CurrentDeposition.H b/Source/Particles/Deposition/CurrentDeposition.H index 97a707d1c..af3b0006b 100644 --- a/Source/Particles/Deposition/CurrentDeposition.H +++ b/Source/Particles/Deposition/CurrentDeposition.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Axel Huebl, David Grote, Maxence Thevenet + * Remi Lehe, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef CURRENTDEPOSITION_H_ #define CURRENTDEPOSITION_H_ diff --git a/Source/Particles/Gather/FieldGather.H b/Source/Particles/Gather/FieldGather.H index 1bac5d3aa..12d9b6291 100644 --- a/Source/Particles/Gather/FieldGather.H +++ b/Source/Particles/Gather/FieldGather.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Axel Huebl, David Grote, Maxence Thevenet + * Revathi Jambunathan, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef FIELDGATHER_H_ #define FIELDGATHER_H_ diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H index ed1c2f371..65c13e39b 100644 --- a/Source/Particles/MultiParticleContainer.H +++ b/Source/Particles/MultiParticleContainer.H @@ -1,3 +1,13 @@ +/* Copyright 2019-2020 Andrew Myers, Ann Almgren, Axel Huebl + * David Grote, Jean-Luc Vay, Junmin Gu + * Luca Fedeli, Mathieu Lobet, Maxence Thevenet + * Remi Lehe, Revathi Jambunathan, Weiqun Zhang + * Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_ParticleContainer_H_ #define WARPX_ParticleContainer_H_ @@ -82,13 +92,6 @@ public: amrex::Real t, amrex::Real dt); /// - /// This pushes the particle positions by one half time step for all the species in the - /// MultiParticleContainer. It is used to desynchronize the particles after initializaton - /// or when restarting from a checkpoint. This is the electrostatic version. - /// - void PushXES (amrex::Real dt); - - /// /// This deposits the particle charge onto rho, accumulating the value for all the species /// in the MultiParticleContainer. rho is assumed to contain node-centered multifabs. /// This version is hard-coded for CIC deposition. @@ -129,7 +132,7 @@ public: /// /// This pushes the particle positions by one half time step for all the species in the /// MultiParticleContainer. It is used to desynchronize the particles after initializaton - /// or when restarting from a checkpoint. This is the electromagnetic version. + /// or when restarting from a checkpoint. /// void PushX (amrex::Real dt); diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index ab836ce9d..f9a0d230b 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -1,3 +1,13 @@ +/* Copyright 2019-2020 Andrew Myers, Ann Almgren, Axel Huebl + * David Grote, Jean-Luc Vay, Luca Fedeli + * Mathieu Lobet, Maxence Thevenet, Remi Lehe + * Revathi Jambunathan, Weiqun Zhang, Yinjian Zhao + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <MultiParticleContainer.H> #include <AMReX_Vector.H> @@ -302,14 +312,6 @@ MultiParticleContainer::EvolveES (const Vector<std::array<std::unique_ptr<MultiF } void -MultiParticleContainer::PushXES (Real dt) -{ - for (auto& pc : allcontainers) { - pc->PushXES(dt); - } -} - -void MultiParticleContainer:: DepositCharge (Vector<std::unique_ptr<MultiFab> >& rho, bool local) { diff --git a/Source/Particles/ParticleCreation/CopyParticle.H b/Source/Particles/ParticleCreation/CopyParticle.H index 5e51c5283..8b2770891 100644 --- a/Source/Particles/ParticleCreation/CopyParticle.H +++ b/Source/Particles/ParticleCreation/CopyParticle.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Axel Huebl, Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef COPYPARTICLE_H_ #define COPYPARTICLE_H_ diff --git a/Source/Particles/ParticleCreation/ElementaryProcess.H b/Source/Particles/ParticleCreation/ElementaryProcess.H index 6c9bdc626..3fe2240cc 100644 --- a/Source/Particles/ParticleCreation/ElementaryProcess.H +++ b/Source/Particles/ParticleCreation/ElementaryProcess.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Axel Huebl, Maxence Thevenet, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef ELEMENTARYPROCESS_H_ #define ELEMENTARYPROCESS_H_ diff --git a/Source/Particles/ParticleCreation/TransformParticle.H b/Source/Particles/ParticleCreation/TransformParticle.H index c0158db78..eb5820e32 100644 --- a/Source/Particles/ParticleCreation/TransformParticle.H +++ b/Source/Particles/ParticleCreation/TransformParticle.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Axel Huebl, Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef TRANSFORMPARTICLE_H_ #define TRANSFORMPARTICLE_H_ diff --git a/Source/Particles/PhotonParticleContainer.H b/Source/Particles/PhotonParticleContainer.H index f84436513..ef32ebcb0 100644 --- a/Source/Particles/PhotonParticleContainer.H +++ b/Source/Particles/PhotonParticleContainer.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Andrew Myers, David Grote, Luca Fedeli + * Maxence Thevenet, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PhotonParticleContainer_H_ #define WARPX_PhotonParticleContainer_H_ diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 92ccc17e7..d007d3c1c 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019 David Grote, Luca Fedeli, Maxence Thevenet + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <limits> #include <sstream> #include <algorithm> diff --git a/Source/Particles/PhysicalParticleContainer.H b/Source/Particles/PhysicalParticleContainer.H index 392d13244..942f7b7a0 100644 --- a/Source/Particles/PhysicalParticleContainer.H +++ b/Source/Particles/PhysicalParticleContainer.H @@ -1,3 +1,12 @@ +/* Copyright 2019-2020 Andrew Myers, Axel Huebl, David Grote + * Ligia Diana Amorim, Luca Fedeli, Maxence Thevenet + * Remi Lehe, Revathi Jambunathan, Weiqun Zhang + * Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PhysicalParticleContainer_H_ #define WARPX_PhysicalParticleContainer_H_ diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 55de2131d..588f8f0ae 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1,3 +1,13 @@ +/* Copyright 2019-2020 Andrew Myers, Aurore Blelly, Axel Huebl + * David Grote, Glenn Richardson, Jean-Luc Vay + * Ligia Diana Amorim, Luca Fedeli, Maxence Thevenet + * Remi Lehe, Revathi Jambunathan, Weiqun Zhang + * Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <limits> #include <sstream> diff --git a/Source/Particles/Pusher/GetAndSetPosition.H b/Source/Particles/Pusher/GetAndSetPosition.H index fe7442a9e..594260703 100644 --- a/Source/Particles/Pusher/GetAndSetPosition.H +++ b/Source/Particles/Pusher/GetAndSetPosition.H @@ -1,3 +1,10 @@ +/* Copyright 2019 David Grote, Maxence Thevenet, Remi Lehe + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_PUSHER_GETANDSETPOSITION_H_ #define WARPX_PARTICLES_PUSHER_GETANDSETPOSITION_H_ diff --git a/Source/Particles/Pusher/UpdateMomentumBoris.H b/Source/Particles/Pusher/UpdateMomentumBoris.H index 160f38ade..13582d7e0 100644 --- a/Source/Particles/Pusher/UpdateMomentumBoris.H +++ b/Source/Particles/Pusher/UpdateMomentumBoris.H @@ -1,3 +1,10 @@ +/* Copyright 2019 David Grote, Maxence Thevenet, Remi Lehe + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_PUSHER_UPDATEMOMENTUM_BORIS_H_ #define WARPX_PARTICLES_PUSHER_UPDATEMOMENTUM_BORIS_H_ diff --git a/Source/Particles/Pusher/UpdateMomentumBorisWithRadiationReaction.H b/Source/Particles/Pusher/UpdateMomentumBorisWithRadiationReaction.H index 0bc0f5d01..d8489e23e 100644 --- a/Source/Particles/Pusher/UpdateMomentumBorisWithRadiationReaction.H +++ b/Source/Particles/Pusher/UpdateMomentumBorisWithRadiationReaction.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_PUSHER_UPDATEMOMENTUM_BORIS_WITHRR_H_ #define WARPX_PARTICLES_PUSHER_UPDATEMOMENTUM_BORIS_WITHRR_H_ diff --git a/Source/Particles/Pusher/UpdateMomentumHigueraCary.H b/Source/Particles/Pusher/UpdateMomentumHigueraCary.H index 51d7fd620..de2436ce2 100644 --- a/Source/Particles/Pusher/UpdateMomentumHigueraCary.H +++ b/Source/Particles/Pusher/UpdateMomentumHigueraCary.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_PUSHER_UPDATEMOMENTUM_HIGUERACARY_H_ #define WARPX_PARTICLES_PUSHER_UPDATEMOMENTUM_HIGUERACARY_H_ diff --git a/Source/Particles/Pusher/UpdateMomentumVay.H b/Source/Particles/Pusher/UpdateMomentumVay.H index f7ec79d89..846d59310 100644 --- a/Source/Particles/Pusher/UpdateMomentumVay.H +++ b/Source/Particles/Pusher/UpdateMomentumVay.H @@ -1,3 +1,10 @@ +/* Copyright 2019 David Grote, Maxence Thevenet, Remi Lehe + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_PUSHER_UPDATEMOMENTUM_VAY_H_ #define WARPX_PARTICLES_PUSHER_UPDATEMOMENTUM_VAY_H_ diff --git a/Source/Particles/Pusher/UpdatePosition.H b/Source/Particles/Pusher/UpdatePosition.H index ad9f0f07e..1968a1439 100644 --- a/Source/Particles/Pusher/UpdatePosition.H +++ b/Source/Particles/Pusher/UpdatePosition.H @@ -1,3 +1,10 @@ +/* Copyright 2019 David Grote, Maxence Thevenet, Remi Lehe + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_PUSHER_UPDATEPOSITION_H_ #define WARPX_PARTICLES_PUSHER_UPDATEPOSITION_H_ diff --git a/Source/Particles/Pusher/UpdatePositionPhoton.H b/Source/Particles/Pusher/UpdatePositionPhoton.H index 325e4b748..44c0afda9 100644 --- a/Source/Particles/Pusher/UpdatePositionPhoton.H +++ b/Source/Particles/Pusher/UpdatePositionPhoton.H @@ -1,3 +1,10 @@ +/* Copyright 2019 David Grote, Luca Fedeli, Maxence Thevenet + * Remi Lehe, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_PUSHER_UPDATEPOSITIONPHOTON_H_ #define WARPX_PARTICLES_PUSHER_UPDATEPOSITIONPHOTON_H_ diff --git a/Source/Particles/RigidInjectedParticleContainer.H b/Source/Particles/RigidInjectedParticleContainer.H index d8ca9105e..7ad7fd82e 100644 --- a/Source/Particles/RigidInjectedParticleContainer.H +++ b/Source/Particles/RigidInjectedParticleContainer.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Andrew Myers, David Grote, Maxence Thevenet + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_RigidInjectedParticleContainer_H_ #define WARPX_RigidInjectedParticleContainer_H_ diff --git a/Source/Particles/RigidInjectedParticleContainer.cpp b/Source/Particles/RigidInjectedParticleContainer.cpp index eb1677194..953874c0f 100644 --- a/Source/Particles/RigidInjectedParticleContainer.cpp +++ b/Source/Particles/RigidInjectedParticleContainer.cpp @@ -1,3 +1,12 @@ +/* Copyright 2019-2020 Andrew Myers, David Grote, Glenn Richardson + * Ligia Diana Amorim, Luca Fedeli, Maxence Thevenet + * Remi Lehe, Revathi Jambunathan, Weiqun Zhang + * Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <limits> #include <sstream> #include <algorithm> diff --git a/Source/Particles/ShapeFactors.H b/Source/Particles/ShapeFactors.H index be79a4871..dd36fb31f 100644 --- a/Source/Particles/ShapeFactors.H +++ b/Source/Particles/ShapeFactors.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef SHAPEFACTORS_H_ #define SHAPEFACTORS_H_ diff --git a/Source/Particles/Sorting/Partition.cpp b/Source/Particles/Sorting/Partition.cpp index e88af017f..c25c24d5d 100644 --- a/Source/Particles/Sorting/Partition.cpp +++ b/Source/Particles/Sorting/Partition.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <SortingUtils.H> #include <PhysicalParticleContainer.H> #include <WarpX.H> diff --git a/Source/Particles/Sorting/SortingUtils.H b/Source/Particles/Sorting/SortingUtils.H index f425c6c7b..f0e991367 100644 --- a/Source/Particles/Sorting/SortingUtils.H +++ b/Source/Particles/Sorting/SortingUtils.H @@ -1,3 +1,10 @@ +/* Copyright 2019-2020 Andrew Myers, Maxence Thevenet, Remi Lehe + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PARTICLES_SORTING_SORTINGUTILS_H_ #define WARPX_PARTICLES_SORTING_SORTINGUTILS_H_ diff --git a/Source/Particles/WarpXParticleContainer.H b/Source/Particles/WarpXParticleContainer.H index c17467d90..845977b00 100644 --- a/Source/Particles/WarpXParticleContainer.H +++ b/Source/Particles/WarpXParticleContainer.H @@ -1,3 +1,12 @@ +/* Copyright 2019-2020 Andrew Myers, Axel Huebl, David Grote + * Jean-Luc Vay, Junmin Gu, Luca Fedeli + * Maxence Thevenet, Remi Lehe, Revathi Jambunathan + * Weiqun Zhang, Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_WarpXParticleContainer_H_ #define WARPX_WarpXParticleContainer_H_ @@ -184,15 +193,6 @@ public: /// This pushes the particle positions by one half time step. /// It is used to desynchronize the particles after initializaton /// or when restarting from a checkpoint. - /// This is the electrostatic version of the particle push. - /// - void PushXES (amrex::Real dt); - - /// - /// This pushes the particle positions by one half time step. - /// It is used to desynchronize the particles after initializaton - /// or when restarting from a checkpoint. - /// This is the electromagnetic version of the particle push. /// void PushX ( amrex::Real dt); void PushX (int lev, amrex::Real dt); diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index a45b764eb..59699d710 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -1,3 +1,12 @@ +/* Copyright 2019-2020 Andrew Myers, Axel Huebl, David Grote + * Jean-Luc Vay, Luca Fedeli, Maxence Thevenet + * Remi Lehe, Revathi Jambunathan, Weiqun Zhang + * Yinjian Zhao, levinem + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <limits> #include <MultiParticleContainer.H> @@ -672,37 +681,6 @@ Real WarpXParticleContainer::maxParticleVelocity(bool local) { } void -WarpXParticleContainer::PushXES (Real dt) -{ - BL_PROFILE("WPC::PushXES()"); - - const int num_levels = finestLevel() + 1; - - for (int lev = 0; lev < num_levels; ++lev) { - const auto& gm = m_gdb->Geom(lev); - const RealBox& prob_domain = gm.ProbDomain(); - for (WarpXParIter pti(*this, lev); pti.isValid(); ++pti) { - auto& particles = pti.GetArrayOfStructs(); - int nstride = particles.dataShape().first; - const long np = pti.numParticles(); - - auto& attribs = pti.GetAttribs(); - auto& uxp = attribs[PIdx::ux]; - auto& uyp = attribs[PIdx::uy]; - auto& uzp = attribs[PIdx::uz]; - - WRPX_PUSH_LEAPFROG_POSITIONS(particles.dataPtr(), nstride, np, - uxp.dataPtr(), uyp.dataPtr(), -#if AMREX_SPACEDIM == 3 - uzp.dataPtr(), -#endif - &dt, - prob_domain.lo(), prob_domain.hi()); - } - } -} - -void WarpXParticleContainer::PushX (amrex::Real dt) { const int nLevels = finestLevel(); diff --git a/Source/Particles/interpolate_cic.F90 b/Source/Particles/interpolate_cic.F90 index 3eb361d2f..97bd8c153 100644 --- a/Source/Particles/interpolate_cic.F90 +++ b/Source/Particles/interpolate_cic.F90 @@ -1,3 +1,9 @@ +! Copyright 2019 Maxence Thevenet, Weiqun Zhang +! +! This file is part of WarpX. +! +! License: BSD-3-Clause-LBNL + module warpx_ES_interpolate_cic use iso_c_binding diff --git a/Source/Particles/push_particles_ES.F90 b/Source/Particles/push_particles_ES.F90 index b84f48d5f..a22ee5a62 100644 --- a/Source/Particles/push_particles_ES.F90 +++ b/Source/Particles/push_particles_ES.F90 @@ -1,3 +1,9 @@ +! Copyright 2019 Maxence Thevenet, Weiqun Zhang +! +! This file is part of WarpX. +! +! License: BSD-3-Clause-LBNL + module warpx_ES_push_particles use iso_c_binding @@ -145,114 +151,4 @@ contains end subroutine warpx_push_leapfrog_2d - -! -! This routine advances the particle positions using the current -! velocity. This is needed to desynchronize the particle positions -! from the velocities after particle initialization. -! -! Arguments: -! particles : a pointer to the particle array-of-structs -! ns : the stride length of particle struct (the size of the struct in number of reals) -! np : the number of particles -! xx_p : the electric field in the x-direction at the particle positions -! vy_p : the electric field in the y-direction at the particle positions -! vz_p : the electric field in the z-direction at the particle positions -! dt : the time step -! prob_lo : the left-hand corner of the problem domain -! prob_hi : the right-hand corner of the problem domain -! - subroutine warpx_push_leapfrog_positions_3d(particles, ns, np, & - vx_p, vy_p, vz_p, dt, & - prob_lo, prob_hi) & - bind(c,name='warpx_push_leapfrog_positions_3d') - integer, value, intent(in) :: ns, np - real(amrex_particle_real), intent(inout) :: particles(ns,np) - real(amrex_particle_real), intent(inout) :: vx_p(np), vy_p(np), vz_p(np) - real(amrex_real), intent(in) :: dt - real(amrex_real), intent(in) :: prob_lo(3), prob_hi(3) - - integer n - - do n = 1, np - - particles(1, n) = particles(1, n) + dt * vx_p(n) - particles(2, n) = particles(2, n) + dt * vy_p(n) - particles(3, n) = particles(3, n) + dt * vz_p(n) - -! bounce off the walls in the x... - do while (particles(1, n) .lt. prob_lo(1) .or. particles(1, n) .gt. prob_hi(1)) - if (particles(1, n) .lt. prob_lo(1)) then - particles(1, n) = 2.d0*prob_lo(1) - particles(1, n) - else - particles(1, n) = 2.d0*prob_hi(1) - particles(1, n) - end if - vx_p(n) = -vx_p(n) - end do - -! ... y... - do while (particles(2, n) .lt. prob_lo(2) .or. particles(2, n) .gt. prob_hi(2)) - if (particles(2, n) .lt. prob_lo(2)) then - particles(2, n) = 2.d0*prob_lo(2) - particles(2, n) - else - particles(2, n) = 2.d0*prob_hi(2) - particles(2, n) - end if - vy_p(n) = -vy_p(n) - end do - -! ... and z directions - do while (particles(3, n) .lt. prob_lo(3) .or. particles(3, n) .gt. prob_hi(3)) - if (particles(3, n) .lt. prob_lo(3)) then - particles(3, n) = 2.d0*prob_lo(3) - particles(3, n) - else - particles(3, n) = 2.d0*prob_hi(3) - particles(3, n) - end if - vz_p(n) = -vz_p(n) - end do - - end do - - end subroutine warpx_push_leapfrog_positions_3d - - subroutine warpx_push_leapfrog_positions_2d(particles, ns, np, & - vx_p, vy_p, dt, & - prob_lo, prob_hi) & - bind(c,name='warpx_push_leapfrog_positions_2d') - integer, value, intent(in) :: ns, np - real(amrex_particle_real), intent(inout) :: particles(ns,np) - real(amrex_particle_real), intent(inout) :: vx_p(np), vy_p(np) - real(amrex_real), intent(in) :: dt - real(amrex_real), intent(in) :: prob_lo(2), prob_hi(2) - - integer n - - do n = 1, np - - particles(1, n) = particles(1, n) + dt * vx_p(n) - particles(2, n) = particles(2, n) + dt * vy_p(n) - -! bounce off the walls in the x... - do while (particles(1, n) .lt. prob_lo(1) .or. particles(1, n) .gt. prob_hi(1)) - if (particles(1, n) .lt. prob_lo(1)) then - particles(1, n) = 2.d0*prob_lo(1) - particles(1, n) - else - particles(1, n) = 2.d0*prob_hi(1) - particles(1, n) - end if - vx_p(n) = -vx_p(n) - end do - -! ... y... - do while (particles(2, n) .lt. prob_lo(2) .or. particles(2, n) .gt. prob_hi(2)) - if (particles(2, n) .lt. prob_lo(2)) then - particles(2, n) = 2.d0*prob_lo(2) - particles(2, n) - else - particles(2, n) = 2.d0*prob_hi(2) - particles(2, n) - end if - vy_p(n) = -vy_p(n) - end do - - end do - - end subroutine warpx_push_leapfrog_positions_2d - end module warpx_ES_push_particles diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp index e72d467d7..bf5377dae 100644 --- a/Source/Python/WarpXWrappers.cpp +++ b/Source/Python/WarpXWrappers.cpp @@ -1,3 +1,11 @@ +/* Copyright 2019 Andrew Myers, Axel Huebl, David Grote + * Luca Fedeli, Maxence Thevenet, Remi Lehe + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpXWrappers.h> #include <WarpXParticleContainer.H> @@ -404,6 +412,11 @@ extern "C" return warpx.plotInt (); } + int warpx_openpmdInt () { + WarpX& warpx = WarpX::GetInstance(); + return warpx.openpmdInt (); + } + void warpx_WriteCheckPointFile () { WarpX& warpx = WarpX::GetInstance(); warpx.WriteCheckPointFile (); @@ -412,6 +425,10 @@ extern "C" WarpX& warpx = WarpX::GetInstance(); warpx.WritePlotFile (); } + void warpx_WriteOpenPMDFile () { + WarpX& warpx = WarpX::GetInstance(); + warpx.WriteOpenPMDFile (); + } int warpx_finestLevel () { WarpX& warpx = WarpX::GetInstance(); diff --git a/Source/Python/WarpXWrappers.h b/Source/Python/WarpXWrappers.h index 4de885b88..53309ad93 100644 --- a/Source/Python/WarpXWrappers.h +++ b/Source/Python/WarpXWrappers.h @@ -1,3 +1,10 @@ +/* Copyright 2019 Andrew Myers, David Grote, Maxence Thevenet + * Remi Lehe, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_WRAPPERS_H_ #define WARPX_WRAPPERS_H_ @@ -95,9 +102,11 @@ extern "C" { int warpx_checkInt (); int warpx_plotInt (); + int warpx_openpmdInt (); void warpx_WriteCheckPointFile (); void warpx_WritePlotFile (); + void warpx_WriteOpenPMDFile (); int warpx_finestLevel (); diff --git a/Source/Python/WarpX_py.H b/Source/Python/WarpX_py.H index d8cf22155..b6a813bfc 100644 --- a/Source/Python/WarpX_py.H +++ b/Source/Python/WarpX_py.H @@ -1,3 +1,10 @@ +/* Copyright 2019 David Grote, Maxence Thevenet, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_PY_H_ #define WARPX_PY_H_ diff --git a/Source/Python/WarpX_py.cpp b/Source/Python/WarpX_py.cpp index 276d637d7..4ca06b644 100644 --- a/Source/Python/WarpX_py.cpp +++ b/Source/Python/WarpX_py.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019 David Grote, Maxence Thevenet, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX_py.H> extern "C" { diff --git a/Source/QED/BreitWheelerDummyTable.H b/Source/QED/BreitWheelerDummyTable.H index e03f9d20b..95f65923e 100644 --- a/Source/QED/BreitWheelerDummyTable.H +++ b/Source/QED/BreitWheelerDummyTable.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_breit_wheeler_dummy_tables_h_ #define WARPX_breit_wheeler_dummy_tables_h_ diff --git a/Source/QED/BreitWheelerEngineInnards.H b/Source/QED/BreitWheelerEngineInnards.H index 640cdfa94..d6c644aa3 100644 --- a/Source/QED/BreitWheelerEngineInnards.H +++ b/Source/QED/BreitWheelerEngineInnards.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_breit_wheeler_engine_innards_h_ #define WARPX_breit_wheeler_engine_innards_h_ diff --git a/Source/QED/BreitWheelerEngineTableBuilder.H b/Source/QED/BreitWheelerEngineTableBuilder.H index e30b82208..98b0b17a4 100644 --- a/Source/QED/BreitWheelerEngineTableBuilder.H +++ b/Source/QED/BreitWheelerEngineTableBuilder.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_breit_wheeler_engine_table_builder_h_ #define WARPX_breit_wheeler_engine_table_builder_h_ diff --git a/Source/QED/BreitWheelerEngineTableBuilder.cpp b/Source/QED/BreitWheelerEngineTableBuilder.cpp index 3326d5b59..7cb41f7ea 100644 --- a/Source/QED/BreitWheelerEngineTableBuilder.cpp +++ b/Source/QED/BreitWheelerEngineTableBuilder.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include "BreitWheelerEngineTableBuilder.H" //Include the full Breit Wheeler engine with table generation support diff --git a/Source/QED/BreitWheelerEngineWrapper.H b/Source/QED/BreitWheelerEngineWrapper.H index 369c64375..102d15efa 100644 --- a/Source/QED/BreitWheelerEngineWrapper.H +++ b/Source/QED/BreitWheelerEngineWrapper.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_breit_wheeler_engine_wrapper_h_ #define WARPX_breit_wheeler_engine_wrapper_h_ diff --git a/Source/QED/BreitWheelerEngineWrapper.cpp b/Source/QED/BreitWheelerEngineWrapper.cpp index c963d44d1..e1eb55714 100644 --- a/Source/QED/BreitWheelerEngineWrapper.cpp +++ b/Source/QED/BreitWheelerEngineWrapper.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli, Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include "BreitWheelerEngineWrapper.H" #include "QedTableParserHelperFunctions.H" diff --git a/Source/QED/QedChiFunctions.H b/Source/QED/QedChiFunctions.H index dd8ffac0e..bdeb6df57 100644 --- a/Source/QED/QedChiFunctions.H +++ b/Source/QED/QedChiFunctions.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_amrex_qed_chi_functions_h_ #define WARPX_amrex_qed_chi_functions_h_ diff --git a/Source/QED/QedTableParserHelperFunctions.H b/Source/QED/QedTableParserHelperFunctions.H index 528613727..dd66f626f 100644 --- a/Source/QED/QedTableParserHelperFunctions.H +++ b/Source/QED/QedTableParserHelperFunctions.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli, Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_amrex_qed_table_parser_helper_functions_h_ #define WARPX_amrex_qed_table_parser_helper_functions_h_ diff --git a/Source/QED/QedWrapperCommons.H b/Source/QED/QedWrapperCommons.H index 210e7247e..1d4500a81 100644 --- a/Source/QED/QedWrapperCommons.H +++ b/Source/QED/QedWrapperCommons.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_amrex_qed_wrapper_commons_h_ #define WARPX_amrex_qed_wrapper_commons_h_ diff --git a/Source/QED/QuantumSyncDummyTable.H b/Source/QED/QuantumSyncDummyTable.H index 587e8b546..f34c521a3 100644 --- a/Source/QED/QuantumSyncDummyTable.H +++ b/Source/QED/QuantumSyncDummyTable.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_quantum_sync_dummy_tables_h_ #define WARPX_quantum_sync_dummy_tables_h_ diff --git a/Source/QED/QuantumSyncEngineInnards.H b/Source/QED/QuantumSyncEngineInnards.H index 6206b103a..64e67690a 100644 --- a/Source/QED/QuantumSyncEngineInnards.H +++ b/Source/QED/QuantumSyncEngineInnards.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_quantum_sync_engine_innards_h_ #define WARPX_quantum_sync_engine_innards_h_ diff --git a/Source/QED/QuantumSyncEngineTableBuilder.H b/Source/QED/QuantumSyncEngineTableBuilder.H index e70f5d02f..16be2d5eb 100644 --- a/Source/QED/QuantumSyncEngineTableBuilder.H +++ b/Source/QED/QuantumSyncEngineTableBuilder.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_quantum_sync_engine_table_builder_h_ #define WARPX_quantum_sync_engine_table_builder_h_ diff --git a/Source/QED/QuantumSyncEngineTableBuilder.cpp b/Source/QED/QuantumSyncEngineTableBuilder.cpp index 51c3720f2..c4e500122 100644 --- a/Source/QED/QuantumSyncEngineTableBuilder.cpp +++ b/Source/QED/QuantumSyncEngineTableBuilder.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include "QuantumSyncEngineTableBuilder.H" //Include the full Quantum Synchrotron engine with table generation support diff --git a/Source/QED/QuantumSyncEngineWrapper.H b/Source/QED/QuantumSyncEngineWrapper.H index df0bdc5f5..e1e3d94eb 100644 --- a/Source/QED/QuantumSyncEngineWrapper.H +++ b/Source/QED/QuantumSyncEngineWrapper.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_quantum_sync_engine_wrapper_h_ #define WARPX_quantum_sync_engine_wrapper_h_ diff --git a/Source/QED/QuantumSyncEngineWrapper.cpp b/Source/QED/QuantumSyncEngineWrapper.cpp index ffafec761..b185251d8 100644 --- a/Source/QED/QuantumSyncEngineWrapper.cpp +++ b/Source/QED/QuantumSyncEngineWrapper.cpp @@ -1,3 +1,9 @@ +/* Copyright 2019 Luca Fedeli, Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include "QuantumSyncEngineWrapper.H" #include "QedTableParserHelperFunctions.H" diff --git a/Source/Utils/IonizationEnergiesTable.H b/Source/Utils/IonizationEnergiesTable.H index 47b71e4f1..f910fa4fe 100644 --- a/Source/Utils/IonizationEnergiesTable.H +++ b/Source/Utils/IonizationEnergiesTable.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Axel Huebl, Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ // This script was automatically generated! // Edit dev/Source/Utils/write_atomic_data_cpp.py instead! #ifndef WARPX_IONIZATION_TABLE_H_ diff --git a/Source/Utils/NCIGodfreyTables.H b/Source/Utils/NCIGodfreyTables.H index 708215c77..0403b10c3 100644 --- a/Source/Utils/NCIGodfreyTables.H +++ b/Source/Utils/NCIGodfreyTables.H @@ -1,3 +1,9 @@ +/* Copyright 2019 Maxence Thevenet + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <AMReX_AmrCore.H> #ifndef WARPX_GODFREY_COEFF_TABLE_H_ diff --git a/Source/Utils/WarpXAlgorithmSelection.H b/Source/Utils/WarpXAlgorithmSelection.H index 7d26e7af5..919428704 100644 --- a/Source/Utils/WarpXAlgorithmSelection.H +++ b/Source/Utils/WarpXAlgorithmSelection.H @@ -1,3 +1,10 @@ +/* Copyright 2019 David Grote, Luca Fedeli, Remi Lehe + * Yinjian Zhao + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef UTILS_WARPXALGORITHMSELECTION_H_ #define UTILS_WARPXALGORITHMSELECTION_H_ diff --git a/Source/Utils/WarpXAlgorithmSelection.cpp b/Source/Utils/WarpXAlgorithmSelection.cpp index 08272089e..f6e2405a9 100644 --- a/Source/Utils/WarpXAlgorithmSelection.cpp +++ b/Source/Utils/WarpXAlgorithmSelection.cpp @@ -1,3 +1,11 @@ +/* Copyright 2019-2020 Axel Huebl, David Grote, Luca Fedeli + * Remi Lehe, Weiqun Zhang, Yinjian Zhao + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpXAlgorithmSelection.H> #include <map> diff --git a/Source/Utils/WarpXConst.H b/Source/Utils/WarpXConst.H index 70436cb72..34e08118d 100644 --- a/Source/Utils/WarpXConst.H +++ b/Source/Utils/WarpXConst.H @@ -1,3 +1,10 @@ +/* Copyright 2019 Andrew Myers, Luca Fedeli, Maxence Thevenet + * Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_CONST_H_ #define WARPX_CONST_H_ diff --git a/Source/Utils/WarpXMovingWindow.cpp b/Source/Utils/WarpXMovingWindow.cpp index 3f607615b..f6cd6de20 100644 --- a/Source/Utils/WarpXMovingWindow.cpp +++ b/Source/Utils/WarpXMovingWindow.cpp @@ -1,3 +1,11 @@ +/* Copyright 2019-2020 Andrew Myers, Axel Huebl, Maxence Thevenet + * Remi Lehe, Revathi Jambunathan, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include "GuardCellManager.H" #include <WarpX.H> #include <WarpXUtil.H> diff --git a/Source/Utils/WarpXTagging.cpp b/Source/Utils/WarpXTagging.cpp index 91bb802e8..b2ac48e40 100644 --- a/Source/Utils/WarpXTagging.cpp +++ b/Source/Utils/WarpXTagging.cpp @@ -1,3 +1,10 @@ +/* Copyright 2019 Axel Huebl, Maxence Thevenet, Weiqun Zhang + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <AMReX_BoxIterator.H> diff --git a/Source/Utils/WarpXUtil.H b/Source/Utils/WarpXUtil.H index e7b2ef196..9231fa60a 100644 --- a/Source/Utils/WarpXUtil.H +++ b/Source/Utils/WarpXUtil.H @@ -1,3 +1,10 @@ +/* Copyright 2019-2020 Andrew Myers, Luca Fedeli, Maxence Thevenet + * Revathi Jambunathan, Revathi Jambunathan + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_UTILS_H_ #define WARPX_UTILS_H_ diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp index a154e93df..983654aed 100644 --- a/Source/Utils/WarpXUtil.cpp +++ b/Source/Utils/WarpXUtil.cpp @@ -1,3 +1,11 @@ +/* Copyright 2019-2020 Andrew Myers, Burlen Loring, Luca Fedeli + * Maxence Thevenet, Remi Lehe, Revathi Jambunathan + * Revathi Jambunathan + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpXUtil.H> #include <WarpXConst.H> #include <AMReX_ParmParse.H> diff --git a/Source/Utils/WarpX_Complex.H b/Source/Utils/WarpX_Complex.H index 1f265d3c5..cda4204a8 100644 --- a/Source/Utils/WarpX_Complex.H +++ b/Source/Utils/WarpX_Complex.H @@ -1,3 +1,10 @@ +/* Copyright 2019-2020 Andrew Myers, David Grote, Maxence Thevenet + * Remi Lehe + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_COMPLEX_H_ #define WARPX_COMPLEX_H_ diff --git a/Source/Utils/atomic_data.txt b/Source/Utils/atomic_data.txt index 140f5a26a..cd58e076a 100644 --- a/Source/Utils/atomic_data.txt +++ b/Source/Utils/atomic_data.txt @@ -1,3 +1,9 @@ +# Copyright 2019 Maxence Thevenet +# +# This file is part of WarpX. +# +# License: BSD-3-Clause-LBNL + # Reference: # Kramida, A., Ralchenko, Yu., Reader, J., and NIST ASD Team (2014). # NIST Atomic Spectra Database (ver. 5.2), [Online]. diff --git a/Source/Utils/utils_ES.F90 b/Source/Utils/utils_ES.F90 index baadeb7af..c11e849eb 100644 --- a/Source/Utils/utils_ES.F90 +++ b/Source/Utils/utils_ES.F90 @@ -1,3 +1,9 @@ +! Copyright 2019 Maxence Thevenet, Remi Lehe +! +! This file is part of WarpX. +! +! License: BSD-3-Clause-LBNL + module warpx_ES_utils use iso_c_binding diff --git a/Source/Utils/write_atomic_data_cpp.py b/Source/Utils/write_atomic_data_cpp.py index 09b7b8300..12cafad0c 100644 --- a/Source/Utils/write_atomic_data_cpp.py +++ b/Source/Utils/write_atomic_data_cpp.py @@ -1,3 +1,10 @@ +# Copyright 2019-2020 Axel Huebl, Luca Fedeli, Maxence Thevenet +# +# +# This file is part of WarpX. +# +# License: BSD-3-Clause-LBNL + ''' This python script reads ionization tables in atomic_data.txt (generated from the NIST website) and extracts ionization levels into C++ file diff --git a/Source/WarpX.H b/Source/WarpX.H index 1549dded2..ae25a8168 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -1,3 +1,14 @@ +/* Copyright 2016-2020 Andrew Myers, Ann Almgren, Aurore Blelly + * Axel Huebl, Burlen Loring, David Grote + * Glenn Richardson, Junmin Gu, Luca Fedeli + * Mathieu Lobet, Maxence Thevenet, Remi Lehe + * Revathi Jambunathan, Weiqun Zhang, Yinjian Zhao + * + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #ifndef WARPX_H_ #define WARPX_H_ @@ -7,6 +18,7 @@ #include <BackTransformedDiagnostic.H> #include <BilinearFilter.H> #include <NCIGodfreyFilter.H> +#include "MultiReducedDiags.H" #ifdef WARPX_USE_PSATD # include <SpectralSolver.H> @@ -33,7 +45,7 @@ #endif #ifdef WARPX_USE_OPENPMD -#include <WarpXOpenPMD.H> +# include <WarpXOpenPMD.H> #endif #include <iostream> @@ -201,6 +213,9 @@ public: amrex::Vector<amrex::Real> mirror_z_width; amrex::Vector<int> mirror_z_npoints; + /// object with all reduced diagnotics, similar to MultiParticleContainer for species. + MultiReducedDiags* reduced_diags; + void applyMirrors(amrex::Real time); void ComputeDt (); @@ -277,12 +292,18 @@ public: int checkInt () const {return check_int;} int plotInt () const {return plot_int;} + int openpmdInt () const {return openpmd_int;} void WriteCheckPointFile () const; + void WriteOpenPMDFile () const; void WritePlotFile () const; void UpdateInSitu () const; void AverageAndPackFields( amrex::Vector<std::string>& varnames, amrex::Vector<amrex::MultiFab>& mf_avg, const int ngrow) const; + void prepareFields( int const step, amrex::Vector<std::string>& varnames, + amrex::Vector<amrex::MultiFab>& mf_avg, + amrex::Vector<const amrex::MultiFab*>& output_mf, + amrex::Vector<amrex::Geometry>& output_geom ) const; void WritePlotFileES(const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& rho, const amrex::Vector<std::unique_ptr<amrex::MultiFab> >& phi, @@ -628,18 +649,13 @@ private: int check_int = -1; int plot_int = -1; - std::string openpmd_backend {"bp"}; + std::string openpmd_backend {"default"}; + int openpmd_int = -1; + bool openpmd_tspf = true; //!< one file per timestep (or one file for all steps) #ifdef WARPX_USE_OPENPMD - bool dump_plotfiles = false; - bool dump_openpmd = true; - bool openpmd_tspf = true; // one file per timestep - //bool openpmd_tspf = false; // one file all timesteps WarpXOpenPMDPlot* m_OpenPMDPlotWriter = nullptr; - -#else - bool dump_plotfiles = true; - bool dump_openpmd = false; #endif + bool plot_rho = false; bool plot_costs = true; bool plot_finepatch = false; diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 5f6f2b2e5..d93fab7df 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -1,3 +1,14 @@ +/* Copyright 2016-2020 Andrew Myers, Ann Almgren, Aurore Blelly + * Axel Huebl, Burlen Loring, David Grote + * Glenn Richardson, Jean-Luc Vay, Junmin Gu + * Mathieu Lobet, Maxence Thevenet, Remi Lehe + * Revathi Jambunathan, Weiqun Zhang, Yinjian Zhao + * levinem + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <WarpX_f.H> #include <WarpXConst.H> @@ -190,6 +201,9 @@ WarpX::WarpX () } do_back_transformed_particles = mypc->doBackTransformedDiagnostics(); + /** create object for reduced diagnostics */ + reduced_diags = new MultiReducedDiags(); + Efield_aux.resize(nlevs_max); Bfield_aux.resize(nlevs_max); @@ -287,6 +301,8 @@ WarpX::~WarpX () ClearLevel(lev); } + delete reduced_diags; + #ifdef BL_USE_SENSEI_INSITU delete insitu_bridge; #endif @@ -466,12 +482,11 @@ WarpX::ReadParameters () amrex::Abort("J-damping can only be done when PML are inside simulation domain (do_pml_in_domain=1)"); } - pp.query("dump_openpmd", dump_openpmd); + pp.query("openpmd_int", openpmd_int); pp.query("openpmd_backend", openpmd_backend); #ifdef WARPX_USE_OPENPMD pp.query("openpmd_tspf", openpmd_tspf); #endif - pp.query("dump_plotfiles", dump_plotfiles); pp.query("plot_costs", plot_costs); pp.query("plot_raw_fields", plot_raw_fields); pp.query("plot_raw_fields_guards", plot_raw_fields_guards); diff --git a/Source/main.cpp b/Source/main.cpp index 19413da7a..fc705bdf0 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -1,3 +1,11 @@ +/* Copyright 2016-2020 Andrew Myers, Ann Almgren, Axel Huebl + * David Grote, Jean-Luc Vay, Remi Lehe + * Revathi Jambunathan, Weiqun Zhang + * + * This file is part of WarpX. + * + * License: BSD-3-Clause-LBNL + */ #include <WarpX.H> #include <WarpXUtil.H> |