Skip to content

Commit 944573c

Browse files
authored
Merge pull request #124 from ajnonaka/negative_excitation_flag
allow for negative excitation flag (do nothing)
2 parents 6e26cad + 663f40f commit 944573c

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Source/FieldSolver/WarpXExternalEMFields.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ WarpX::ApplyExternalFieldExcitationOnGrid (
114114
// A flag is used to determine the type of excitation.
115115
// If flag == 1, it is a hard source and the field = excitation
116116
// If flag == 2, if is a soft source and the field += excitation
117-
// If flag == 0, the excitation parser is not computed and the field is unchanged.
118-
// If flag is not 0, or 1, or 2, the code will Abort!
117+
// If flag <= 0, the excitation parser is not computed and the field is unchanged.
118+
// If flag is greater than 2, the code will Abort!
119119

120120
// Gpu vector to store Ex-Bz staggering (Hx-Hz for LLG)
121121
GpuArray<int,3> mfx_stag, mfy_stag, mfz_stag;
@@ -169,8 +169,8 @@ WarpX::ApplyExternalFieldExcitationOnGrid (
169169
if (flag_type == 2._rt and dt_type_flag == 1) {
170170
dt_type_factor = 0.5_rt;
171171
}
172-
if (flag_type != 0._rt && flag_type != 1._rt && flag_type != 2._rt) {
173-
amrex::Abort("flag type for excitation must be 0, or 1, or 2!");
172+
if (flag_type > 2._rt) {
173+
amrex::Abort("flag type for excitation must be <= 2");
174174
} else if ( flag_type > 0._rt ) {
175175
Fx(i, j, k, n) = Fx(i,j,k,n)*(flag_type-1.0_rt)
176176
+ dt_type_factor * xfield_parser(x,y,z,t);
@@ -188,8 +188,8 @@ WarpX::ApplyExternalFieldExcitationOnGrid (
188188
if (flag_type == 2._rt and dt_type_flag == 1) {
189189
dt_type_factor = 0.5_rt;
190190
}
191-
if (flag_type != 0._rt && flag_type != 1._rt && flag_type != 2._rt) {
192-
amrex::Abort("flag type for excitation must be 0, or 1, or 2!");
191+
if (flag_type > 2._rt) {
192+
amrex::Abort("flag type for excitation must be <= 2");
193193
} else if ( flag_type > 0._rt ) {
194194
Fy(i, j, k, n) = Fy(i,j,k,n)*(flag_type-1.0_rt)
195195
+ dt_type_factor * yfield_parser(x,y,z,t);
@@ -207,8 +207,8 @@ WarpX::ApplyExternalFieldExcitationOnGrid (
207207
if (flag_type == 2._rt and dt_type_flag == 1) {
208208
dt_type_factor = 0.5_rt;
209209
}
210-
if (flag_type != 0._rt && flag_type != 1._rt && flag_type != 2._rt) {
211-
amrex::Abort("flag type for excitation must be 0, or 1, or 2!");
210+
if (flag_type > 2._rt) {
211+
amrex::Abort("flag type for excitation must be <= 2");
212212
} else if ( flag_type > 0._rt ) {
213213
Fz(i, j, k,n) = Fz(i,j,k,n)*(flag_type-1.0_rt)
214214
+ dt_type_factor * zfield_parser(x,y,z,t);

0 commit comments

Comments
 (0)