Skip to content

Commit cab0616

Browse files
committed
adding normal only
1 parent 6381b4e commit cab0616

File tree

1 file changed

+3
-51
lines changed

1 file changed

+3
-51
lines changed

Source/Particles/ParticleBoundaryBuffer.cpp

+3-51
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,6 @@ struct CopyAndTimestamp {
167167
int m_delta_index;
168168
int m_normal_index;
169169
int m_step;
170-
const amrex::Real m_dt;
171-
amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> m_plo;
172-
amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> m_phi;
173170
int m_idim;
174171
int m_iside;
175172

@@ -189,59 +186,16 @@ struct CopyAndTimestamp {
189186
for (int j = 0; j < src.m_num_runtime_int; ++j) {
190187
dst.m_runtime_idata[j][dst_i] = src.m_runtime_idata[j][src_i];
191188
}
192-
193-
amrex::ParticleReal const ux = dst.m_rdata[PIdx::ux][dst_i];
194-
amrex::ParticleReal const uy = dst.m_rdata[PIdx::uy][dst_i];
195-
amrex::ParticleReal const uz = dst.m_rdata[PIdx::uz][dst_i];
196189

197190
dst.m_runtime_idata[m_step_index][dst_i] = m_step;
198-
amrex::Real delta_t;
199-
amrex::Real exit_velocity = 0;
200-
if (m_idim == 0) {
201-
exit_velocity = ux;
202-
} else if (m_idim == 1) {
203-
exit_velocity = uy;
204-
} else {
205-
exit_velocity = uz;
206-
}
191+
dst.m_runtime_rdata[m_delta_index][dst_i] = 0._rt;
207192

208-
if (m_iside==1){ //iside=1, we are in the right side
209-
delta_t = std::abs(dst.m_rdata[PIdx::z][dst_i]-m_phi[m_idim])/exit_velocity;
210-
dst.m_runtime_rdata[m_delta_index][dst_i] = delta_t;
211-
} else{
212-
delta_t = std::abs(dst.m_rdata[PIdx::z][dst_i]-m_plo[m_idim])/exit_velocity;
213-
dst.m_runtime_rdata[m_delta_index][dst_i] = delta_t;
214-
}
215-
}
216193
//calculation of the normal to the boundary
217194
std::array<double, 3> n = {0.0, 0.0, 0.0};
218195
n[m_idim]=1-2*m_iside;
219196
dst.m_runtime_rdata[m_normal_index][dst_i]= n[0];
220197
dst.m_runtime_rdata[m_normal_index+1][dst_i]= n[1];
221198
dst.m_runtime_rdata[m_normal_index+2][dst_i]= n[2];
222-
223-
#if (defined WARPX_DIM_3D)
224-
[dst_i]-=(m_dt-delta_t)*ux;
225-
dst.m_rdata[PIdx::y][dst_i]-=(m_dt-dedst.m_rdata[PIdx::x]lta_t)*uy;
226-
dst.m_rdata[PIdx::z][dst_i]-=(m_dt-delta_t)*uz;
227-
#elif (defined WARPX_DIM_XZ)
228-
dst.m_rdata[PIdx::x][dst_i]-=(m_dt-delta_t)*ux;
229-
dst.m_rdata[PIdx::z][dst_i]-=(m_dt-delta_t)*uz;
230-
#elif (defined WARPX_DIM_RZ)
231-
amrex::ParticleReal theta_temp=dst.m_rdata[PIdx::theta][dst_i];
232-
amrex::ParticleReal x_temp=dst.m_rdata[PIdx::x][dst_i]*std::cos(theta_temp);
233-
amrex::ParticleReal y_temp=dst.m_rdata[PIdx::y][dst_i]*std::sin(theta);
234-
amrex::ParticleReal z_temp=dst.m_rdata[PIdx::z][dst_i];
235-
x_temp -=(m_dt-delta_t)*ux;
236-
y_temp -=(m_dt-delta_t)*uy;
237-
z_temp -=(m_dt-delta_t)*uz;
238-
theta_temp= std::atan2(y_temp, x_temp);
239-
dst.m_rdata[PIdx::theta][dst_i] = theta_temp;
240-
dst.m_rdata[PIdx::x][dst_i] =x_temp/std::cos(theta_temp);
241-
dst.m_rdata[PIdx::z][dst_i] =z_temp/std::sin(theta_temp);
242-
#else (defined WARPX_DIM_1D_Z)
243-
dst.m_rdata[PIdx::z][dst_i] -=(m_dt-delta_t)*uz;
244-
#endif
245199
}
246200
};
247201

@@ -467,17 +421,15 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc,
467421
{
468422
WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterAndTransform");
469423
auto& warpx = WarpX::GetInstance();
470-
const auto dt = warpx.getdt(pti.GetLevel());
471424
auto string_to_index_intcomp = buffer[i].getParticleRuntimeiComps();
472425
const int step_scraped_index = string_to_index_intcomp.at("stepScraped");
473426
auto string_to_index_realcomp = buffer[i].getParticleRuntimeComps();
474427
const int delta_index = string_to_index_realcomp.at("deltaTimeScraped");
475428
const int normal_index = string_to_index_realcomp.at("nx");
476429
const int step = warpx_instance.getistep(0);
477-
478430
amrex::filterAndTransformParticles(ptile_buffer, ptile,
479431
predicate,
480-
CopyAndTimestamp{step_scraped_index, delta_index, normal_index, step, dt, plo, phi, idim, iside},
432+
CopyAndTimestamp{step_scraped_index, delta_index, normal_index, step, idim, iside},
481433
0, dst_index);
482434
}
483435
}
@@ -612,4 +564,4 @@ ParticleBoundaryBuffer::getParticleBufferPointer(const std::string species_name,
612564
auto index = WarpX::GetInstance().GetPartContainer().getSpeciesID(species_name);
613565

614566
return &buffer[index];
615-
}
567+
}

0 commit comments

Comments
 (0)