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

[WIP] Implement finite difference solver with user-input custom stencil coefficients #5433

Open
wants to merge 17 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions Examples/Tests/langmuir/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -409,3 +409,13 @@ if(WarpX_FFT)
OFF # dependency
)
endif()

add_warpx_test(
test_3d_langmuir_multi_customcoef # name
3 # dims
2 # nprocs
inputs_test_3d_langmuir_multi_customcoef # inputs
"analysis_3d.py diags/diag1000040" # analysis
"analysis_default_regression.py --path diags/diag1000040" # checksum
OFF # dependency
)
13 changes: 13 additions & 0 deletions Examples/Tests/langmuir/inputs_test_3d_langmuir_multi_customcoef
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# base input parameters
FILE = inputs_base_3d

algo.maxwell_solver = customcoef

algo.custom_coef_upward_stencil_z = 1 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Switch to customized coefficients

algo.custom_coef_downward_stencil_z = 1 0

algo.custom_coef_upward_stencil_x = 1 0
algo.custom_coef_downward_stencil_x = 1 0

algo.custom_coef_upward_stencil_y = 1 0
algo.custom_coef_downward_stencil_y = 1 0
3 changes: 3 additions & 0 deletions Source/Evolve/WarpXComputeDt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "WarpX.H"

#ifndef WARPX_DIM_RZ
# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianCustomCoefAlgorithm.H"
# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianCKCAlgorithm.H"
# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianNodalAlgorithm.H"
# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H"
Expand Down Expand Up @@ -85,6 +86,8 @@ WarpX::ComputeDt ()
deltat = cfl * CartesianYeeAlgorithm::ComputeMaxDt(dx);
} else if (electromagnetic_solver_id == ElectromagneticSolverAlgo::CKC) {
deltat = cfl * CartesianCKCAlgorithm::ComputeMaxDt(dx);
} else if (electromagnetic_solver_id == ElectromagneticSolverAlgo::CustomCoef) {
deltat = cfl * CartesianCustomCoefAlgorithm::ComputeMaxDt(dx);
#endif
} else {
WARPX_ABORT_WITH_MESSAGE("ComputeDt: Unknown algorithm");
Expand Down
6 changes: 6 additions & 0 deletions Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifndef WARPX_DIM_RZ
# include "FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H"
# include "FiniteDifferenceAlgorithms/CartesianCKCAlgorithm.H"
# include "FiniteDifferenceAlgorithms/CartesianCustomCoefAlgorithm.H"
# include "FiniteDifferenceAlgorithms/CartesianNodalAlgorithm.H"
#else
# include "FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H"
Expand Down Expand Up @@ -107,6 +108,11 @@ void FiniteDifferenceSolver::EvolveB (
} else if (m_fdtd_algo == ElectromagneticSolverAlgo::CKC) {

EvolveBCartesian <CartesianCKCAlgorithm> ( Bfield, Efield, Gfield, lev, dt );

} else if (m_fdtd_algo == ElectromagneticSolverAlgo::CustomCoef) {

EvolveBCartesian <CartesianCustomCoefAlgorithm> ( Bfield, Efield, Gfield, lev, dt );

} else if (m_fdtd_algo == ElectromagneticSolverAlgo::ECT) {
EvolveBCartesianECT(Bfield, face_areas, area_mod, ECTRhofield, Venl, flag_info_cell,
borrowing, lev, dt);
Expand Down
5 changes: 5 additions & 0 deletions Source/FieldSolver/FiniteDifferenceSolver/EvolveE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef WARPX_DIM_RZ
# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H"
# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianCKCAlgorithm.H"
# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianCustomCoefAlgorithm.H"
# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianNodalAlgorithm.H"
#else
# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H"
Expand Down Expand Up @@ -91,6 +92,10 @@ void FiniteDifferenceSolver::EvolveE (

EvolveECartesian <CartesianCKCAlgorithm> ( Efield, Bfield, Jfield, eb_update_E, Ffield, lev, dt );

} else if (m_fdtd_algo == ElectromagneticSolverAlgo::CustomCoef) {

EvolveECartesian <CartesianCustomCoefAlgorithm> ( Efield, Bfield, Jfield, eb_update_E, Ffield, lev, dt );

#endif
} else {
WARPX_ABORT_WITH_MESSAGE("EvolveE: Unknown algorithm");
Expand Down
Loading
Loading