Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the order of applying excitation field and boundary conditions #20

Draft
wants to merge 35 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5e71370
change plot.period to plot.intervals
Jun 10, 2021
b2d7bbd
changed plot.period to plot.intervals
Jun 10, 2021
3a82ef3
updated Examples/Tests/Macroscopic_Maxwell/inputs_3d_LLG_noMs
jackieyao0114 Jun 10, 2021
7daf765
Merge branch 'development' of https://github.com/jackieyao0114/artemi…
jackieyao0114 Jun 10, 2021
ce7f3d8
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
jackieyao0114 Jun 10, 2021
1b9fdb1
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jun 10, 2021
aed980f
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jun 15, 2021
eea5c52
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jun 22, 2021
328c46c
Merge branch 'development' of https://github.com/jackieyao0114/artemi…
jackieyao0114 Jun 25, 2021
3200d03
some tweaks Examples/Tests/Macroscopic_Maxwell/inputs_3d_LLG_noMs
jackieyao0114 Jun 29, 2021
32b9927
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
jackieyao0114 Jun 30, 2021
1ae1d92
Merge branch 'development' of https://github.com/jackieyao0114/artemi…
jackieyao0114 Jun 30, 2021
6dde33a
fixed bug in getting mag_exchange_init_style and mag_anisotropy_init_…
jackieyao0114 Jun 30, 2021
bfc0b01
Merge branch 'development' of https://github.com/jackieyao0114/artemi…
ajnonaka Jul 1, 2021
f581c09
EOL whitespace
ajnonaka Jul 1, 2021
6181e2a
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
jackieyao0114 Jul 7, 2021
c8faeea
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
jackieyao0114 Jul 7, 2021
3e39eae
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
jackieyao0114 Jul 16, 2021
7a7f34a
Merge branch 'development' of https://github.com/jackieyao0114/artemi…
jackieyao0114 Jul 16, 2021
7b48576
fixed the order of applying excitation and boundary conditions
jackieyao0114 Jul 20, 2021
131ab6c
flipped order of applying pml and pec
jackieyao0114 Jul 22, 2021
b431dcf
fix conflicts
jackieyao0114 Jul 22, 2021
b79b46c
fix ApplyBfieldBoundary arguments
jackieyao0114 Jul 22, 2021
5847439
fixed arguments of EvolveB in Source/Evolve/WarpXEvolve.cpp
jackieyao0114 Jul 22, 2021
9dc0f9a
fixed errors from merging: added EvolveG; removed SilverMuellerBoundary
jackieyao0114 Jul 22, 2021
349439d
indentation
ajnonaka Jul 29, 2021
f12495e
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Jul 29, 2021
c78f67b
whitespace
ajnonaka Jul 29, 2021
1642173
get this compiling again
ajnonaka Jul 30, 2021
16d42f1
Update Source/Evolve/WarpXEvolve.cpp
ajnonaka Aug 12, 2021
8d222e8
Update Source/Evolve/WarpXEvolve.cpp
ajnonaka Aug 12, 2021
8e0563e
Apply suggestions from code review
ajnonaka Aug 12, 2021
21640df
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
jackieyao0114 Aug 12, 2021
f9aa164
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Aug 26, 2021
96d5180
Merge branch 'development' of https://github.com/ECP-WarpX/artemis in…
ajnonaka Nov 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions Source/Evolve/WarpXEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,6 @@ WarpX::OneStep_nosub (Real cur_time)
#ifndef WARPX_MAG_LLG
EvolveB(0.5_rt * dt[0], DtType::FirstHalf); // We now have B^{n+1/2}
FillBoundaryB(guard_cells.ng_FieldSolver);
// ApplyExternalFieldExcitation
ApplyExternalFieldExcitationOnGrid(ExternalFieldType::BfieldExternal); // apply B external excitation; soft source to be fixed
#endif

#ifdef WARPX_MAG_LLG
Expand Down Expand Up @@ -468,11 +466,9 @@ WarpX::OneStep_nosub (Real cur_time)
}

FillBoundaryE(guard_cells.ng_FieldSolver);
// ApplyExternalFieldExcitation
ApplyExternalFieldExcitationOnGrid(ExternalFieldType::EfieldExternal); // apply E external excitation; soft source to be fixed

EvolveF(0.5_rt * dt[0], DtType::SecondHalf);
EvolveG(0.5_rt * dt[0], DtType::SecondHalf);
EvolveF(0.5_rt * dt[0], DtType::SecondHalf);
EvolveG(0.5_rt * dt[0], DtType::SecondHalf);
ajnonaka marked this conversation as resolved.
Show resolved Hide resolved
#ifndef WARPX_MAG_LLG
EvolveB(0.5_rt * dt[0], DtType::SecondHalf); // We now have B^{n+1}

Expand All @@ -497,8 +493,6 @@ WarpX::OneStep_nosub (Real cur_time)
// outdated.
if (safe_guard_cells) {
FillBoundaryB(guard_cells.ng_alloc_EB);
// ApplyExternalFieldExcitation
ApplyExternalFieldExcitationOnGrid(ExternalFieldType::BfieldExternal); // redundant for hs; need to fix the way to increment ss
}
#ifdef WARPX_MAG_LLG
if (WarpX::em_solver_medium == MediumForEM::Macroscopic) {
Expand All @@ -518,8 +512,6 @@ WarpX::OneStep_nosub (Real cur_time)
if ( safe_guard_cells ){
FillBoundaryH(guard_cells.ng_alloc_EB);
FillBoundaryM(guard_cells.ng_alloc_EB);
// ApplyExternalFieldExcitation
ApplyExternalFieldExcitationOnGrid(ExternalFieldType::HfieldExternal); // redundant for hs; need to fix the way to increment ss
}
#endif //
} // !PSATD
Expand Down
34 changes: 26 additions & 8 deletions Source/FieldSolver/WarpXPushFieldsEM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,14 +419,15 @@ WarpX::PushPSATD ()
// Evolve the fields in the PML boxes
for (int lev = 0; lev <= finest_level; ++lev)
{
if (do_pml && pml[lev]->ok())
{
pml[lev]->PushPSATD(lev);
}
ApplyEfieldBoundary(lev, PatchType::fine);
if (lev > 0) ApplyEfieldBoundary(lev, PatchType::coarse);
ApplyBfieldBoundary(lev, PatchType::fine, DtType::FirstHalf);
if (lev > 0) ApplyBfieldBoundary(lev, PatchType::coarse, DtType::FirstHalf);

if (do_pml && pml[lev]->ok())
{
pml[lev]->PushPSATD(lev);
}
ajnonaka marked this conversation as resolved.
Show resolved Hide resolved
}
#endif
}
Expand Down Expand Up @@ -470,6 +471,11 @@ WarpX::EvolveB (int lev, PatchType patch_type, amrex::Real a_dt, DtType a_dt_typ
m_face_areas[lev], lev, a_dt);
}

// Apply external field excitation prior to applying boundary conditions such that excitation does not overwrite B.C.
ApplyExternalFieldExcitationOnGrid(ExternalFieldType::BfieldExternal); // apply B external excitation

ApplyBfieldBoundary(lev, patch_type, a_dt_type);

// Evolve B field in PML cells
if (do_pml && pml[lev]->ok()) {
if (patch_type == PatchType::fine) {
Expand All @@ -481,7 +487,6 @@ WarpX::EvolveB (int lev, PatchType patch_type, amrex::Real a_dt, DtType a_dt_typ
}
}

ApplyBfieldBoundary(lev, patch_type, a_dt_type);
}


Expand Down Expand Up @@ -519,6 +524,11 @@ WarpX::EvolveE (int lev, PatchType patch_type, amrex::Real a_dt)
F_cp[lev], lev, a_dt );
}

// Apply external field excitation prior to applying boundary conditions such that excitation does not overwrite B.C.
ApplyExternalFieldExcitationOnGrid(ExternalFieldType::EfieldExternal); // apply E external excitation

ApplyEfieldBoundary(lev, patch_type);

// Evolve E field in PML cells
if (do_pml && pml[lev]->ok()) {
if (patch_type == PatchType::fine) {
Expand Down Expand Up @@ -546,8 +556,6 @@ WarpX::EvolveE (int lev, PatchType patch_type, amrex::Real a_dt)
}
}

ApplyEfieldBoundary(lev, patch_type);

}


Expand Down Expand Up @@ -681,6 +689,11 @@ WarpX::MacroscopicEvolveE (int lev, PatchType patch_type, amrex::Real a_dt) {
amrex::Abort("Macroscopic EvolveE is not implemented for lev > 0, yet.");
}

// Apply external field excitation prior to the boundary condition such that excitation does not overwrite B.C.
ApplyExternalFieldExcitationOnGrid(ExternalFieldType::EfieldExternal); // apply E external excitation

ApplyEfieldBoundary(lev, patch_type);

// Evolve E field in PML cells
if (do_pml && pml[lev]->ok()) {
if (patch_type == PatchType::fine) {
Expand Down Expand Up @@ -716,7 +729,6 @@ WarpX::MacroscopicEvolveE (int lev, PatchType patch_type, amrex::Real a_dt) {
}
}

ApplyEfieldBoundary(lev, patch_type);
}

#ifdef WARPX_MAG_LLG
Expand Down Expand Up @@ -751,6 +763,9 @@ WarpX::MacroscopicEvolveHM (int lev, PatchType patch_type, amrex::Real a_dt) {
amrex::Abort("Macroscopic EvolveHM is not implemented for lev > 0 yet");
}

// Apply external field excitation prior to applying boundary conditions such that excitation does not overwrite B.C.
ApplyExternalFieldExcitationOnGrid(ExternalFieldType::HfieldExternal); // apply H external excitation

// Evolve H field in PML cells
if (do_pml && pml[lev]->ok()) {
if (patch_type == PatchType::fine) {
Expand Down Expand Up @@ -794,6 +809,9 @@ WarpX::MacroscopicEvolveHM_2nd (int lev, PatchType patch_type, amrex::Real a_dt)
amrex::Abort("Macroscopic EvolveHM_2nd is not implemented for lev > 0 yet");
}

// Apply external field excitation prior to applying boundary conditions such that excitation does not overwrite B.C.
ApplyExternalFieldExcitationOnGrid(ExternalFieldType::HfieldExternal); // apply H external excitation

// Evolve H field in PML cells
if (do_pml && pml[lev]->ok()) {
if (patch_type == PatchType::fine) {
Expand Down
3 changes: 1 addition & 2 deletions Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1512,12 +1512,11 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
{
// Declare nodal flags
IntVect Ex_nodal_flag, Ey_nodal_flag, Ez_nodal_flag;
IntVect Bx_nodal_flag, By_nodal_flag, Bz_nodal_flag;
#ifdef WARPX_MAG_LLG
IntVect Mx_nodal_flag, My_nodal_flag, Mz_nodal_flag;
IntVect Hx_nodal_flag, Hy_nodal_flag, Hz_nodal_flag;
IntVect Hx_bias_nodal_flag, Hy_bias_nodal_flag, Hz_bias_nodal_flag;
#else
IntVect Bx_nodal_flag, By_nodal_flag, Bz_nodal_flag;
#endif
IntVect jx_nodal_flag, jy_nodal_flag, jz_nodal_flag;
IntVect rho_nodal_flag;
Expand Down