Skip to content

Commit 6580212

Browse files
move field sover condition check to field solver
- remove static assert from `gridConfig.unitless` - add condition check for `DirectionalSplitting` - move Courant Firedrich Levy condition to `YeeSolver` and `NoSolver`
1 parent b509143 commit 6580212

File tree

4 files changed

+51
-18
lines changed

4 files changed

+51
-18
lines changed

src/picongpu/include/fields/MaxwellSolver/DirSplitting/DirSplitting.hpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,34 @@ namespace dirSplitting
4040
{
4141
using namespace PMacc;
4242

43-
class DirSplitting
43+
/** Check Directional Splitting grid and time conditions
44+
*
45+
* This is a workaround that the condition check is only
46+
* triggered if the current used solver is `DirSplitting`
47+
*/
48+
template<typename T_UsedSolver, typename T_Dummy=void>
49+
struct ConditionCheck
50+
{
51+
};
52+
53+
template<typename T_Dummy>
54+
struct ConditionCheck<DirSplitting, T_Dummy>
55+
{
56+
/* Directional Splitting conditions:
57+
*
58+
* using SI units to avoid round off errors
59+
*/
60+
PMACC_CASSERT_MSG(DirectionSplitting_Set_dX_equal_dt_times_c____check_your_gridConfig_param_file,
61+
(SI::SPEED_OF_LIGHT_SI * SI::DELTA_T_SI) == SI::CELL_WIDTH_SI);
62+
PMACC_CASSERT_MSG(DirectionSplitting_use_cubic_cells____check_your_gridConfig_param_file,
63+
SI::CELL_HEIGHT_SI == SI::CELL_WIDTH_SI);
64+
#if (SIMDIM == DIM3)
65+
PMACC_CASSERT_MSG(DirectionSplitting_use_cubic_cells____check_your_gridConfig_param_file,
66+
SI::CELL_DEPTH_SI == SI::CELL_WIDTH_SI);
67+
#endif
68+
};
69+
70+
class DirSplitting : private ConditionCheck<fieldSolver::FieldSolver>
4471
{
4572
private:
4673
template<typename CursorE, typename CursorB, typename GridSize>

src/picongpu/include/fields/MaxwellSolver/None/NoSolver.hpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,31 @@ namespace picongpu
3434
{
3535
using namespace PMacc;
3636

37+
/** Check Yee grid and time conditions
38+
*
39+
* This is a workaround that the condition check is only
40+
* triggered if the current used solver is `NoSolver`
41+
*/
42+
template<typename T_UsedSolver, typename T_Dummy=void>
43+
struct ConditionCheck
44+
{
45+
};
46+
47+
template<typename T_Dummy>
48+
struct ConditionCheck<NoSolver, T_Dummy>
49+
{
50+
/* Courant-Friedrichs-Levy-Condition for Yee Field Solver: */
51+
PMACC_CASSERT_MSG(Courant_Friedrichs_Levy_condition_failure____check_your_gridConfig_param_file,
52+
(SPEED_OF_LIGHT*SPEED_OF_LIGHT*DELTA_T*DELTA_T*INV_CELL2_SUM)<=1.0);
53+
};
3754

38-
class NoSolver
55+
class NoSolver : private ConditionCheck<fieldSolver::FieldSolver>
3956
{
4057
private:
4158
typedef MappingDesc::SuperCellSize SuperCellSize;
4259

4360
MappingDesc cellDescription;
4461

45-
template<uint32_t AREA>
46-
void updateE()
47-
{
48-
return;
49-
}
50-
51-
template<uint32_t AREA>
52-
void updateBHalf()
53-
{
54-
return;
55-
}
56-
5762
public:
5863

5964
NoSolver(MappingDesc cellDescription) : cellDescription(cellDescription)

src/picongpu/include/fields/MaxwellSolver/Yee/YeeSolver.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,18 @@ class YeeSolver
5757
private:
5858
typedef MappingDesc::SuperCellSize SuperCellSize;
5959

60+
6061
FieldE* fieldE;
6162
FieldB* fieldB;
6263
MappingDesc cellDescription;
6364

6465
template<uint32_t AREA>
6566
void updateE()
6667
{
68+
/* Courant-Friedrichs-Levy-Condition for Yee Field Solver: */
69+
PMACC_CASSERT_MSG(Courant_Friedrichs_Levy_condition_failure____check_your_gridConfig_param_file,
70+
(SPEED_OF_LIGHT*SPEED_OF_LIGHT*DELTA_T*DELTA_T*INV_CELL2_SUM)<=1.0);
71+
6772
typedef SuperCellDescription<
6873
SuperCellSize,
6974
typename CurlB::LowerMargin,

src/picongpu/include/simulation_defines/unitless/gridConfig.unitless

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,4 @@ namespace picongpu
4747
const float_X INV_CELL2_SUM = 1.0 / ( CELL_WIDTH * CELL_WIDTH );
4848
#endif
4949

50-
/* Courant-Friedrichs-Levy-Condition for Yee Field Solver: */
51-
PMACC_CASSERT_MSG(Courant_Friedrichs_Levy_condition_failure____check_your_gridConfig_param_file,
52-
(SPEED_OF_LIGHT*SPEED_OF_LIGHT*DELTA_T*DELTA_T*INV_CELL2_SUM)<=1.0);
53-
5450
}

0 commit comments

Comments
 (0)