diff --git a/Examples/Physics_applications/spacecraft_charging/inputs_test_rz_spacecraft_charging_picmi.py b/Examples/Physics_applications/spacecraft_charging/inputs_test_rz_spacecraft_charging_picmi.py index e3bc888f600..2e94e090b01 100644 --- a/Examples/Physics_applications/spacecraft_charging/inputs_test_rz_spacecraft_charging_picmi.py +++ b/Examples/Physics_applications/spacecraft_charging/inputs_test_rz_spacecraft_charging_picmi.py @@ -18,7 +18,7 @@ from pywarpx import picmi from pywarpx.callbacks import installafterEsolve, installafterInitEsolve -from pywarpx.fields import ExWrapper, EzWrapper, PhiFPWrapper, RhoFPWrapper +from pywarpx.fields import PhiFPWrapper, RhoFPWrapper from pywarpx.particle_containers import ParticleBoundaryBufferWrapper @@ -49,10 +49,11 @@ def correct_space_charge_fields(self, q=None): q = compute_actual_charge_on_spacecraft() # Correct fields so as to recover the actual charge - Er = ExWrapper(include_ghosts=True) - Er[...] += (q - q_v) * self.normalized_Er - Ez = EzWrapper(include_ghosts=True) - Ez[...] += (q - q_v) * self.normalized_Ez + # TODO: add guard cells + Er = sim.extension.warpx.multifab("Efield_fp[x]", 0) + Er.saxpy(Er, (q - q_v), self.normalized_Er, 0, 0, 1, 0) + Ez = sim.extension.warpx.multifab("Efield_fp[z]", 0) + Ez.saxpy(Ez, (q - q_v), self.normalized_Ez, 0, 0, 1, 0) phi = PhiFPWrapper(include_ghosts=True) phi[...] += (q - q_v) * self.normalized_phi self.spacecraft_potential += (q - q_v) * self.spacecraft_capacitance @@ -79,10 +80,11 @@ def save_normalized_vacuum_Efields( assert np.all(abs(rho[...]) < 1.0e-11) # Record fields - Er = ExWrapper(include_ghosts=True)[:, :] - self.normalized_Er = Er[...] / q_v - Ez = EzWrapper(include_ghosts=True)[:, :] - self.normalized_Ez = Ez[...] / q_v + # TODO: add guard cells + self.normalized_Er = sim.extension.warpx.multifab("Efield_fp[x]", 0).copy() + self.normalized_Er.mult(1 / q_v, 0) + self.normalized_Ez = sim.extension.warpx.multifab("Efield_fp[z]", 0).copy() + self.normalized_Ez.mult(1 / q_v, 0) phi = PhiFPWrapper(include_ghosts=True)[:, :] self.normalized_phi = phi[...] / q_v