@@ -42,34 +42,6 @@ std::string ParaviewFoldername(const config::ProblemData::Type solver_t)
42
42
}
43
43
}
44
44
45
- // bool WriteParaviewFields(const config::ProblemData::Type solver_t, const IoData &iodata)
46
- // {
47
- // if (solver_t == config::ProblemData::Type::DRIVEN)
48
- // {
49
- // return (iodata.solver.driven.delta_post > 0);
50
- // }
51
- // else if (solver_t == config::ProblemData::Type::EIGENMODE)
52
- // {
53
- // return (iodata.solver.eigenmode.n_post > 0);
54
- // }
55
- // else if (solver_t == config::ProblemData::Type::ELECTROSTATIC)
56
- // {
57
- // return (iodata.solver.electrostatic.n_post > 0);
58
- // }
59
- // else if (solver_t == config::ProblemData::Type::ELECTROSTATIC)
60
- // {
61
- // return (iodata.solver.magnetostatic.n_post > 0);
62
- // }
63
- // else if (solver_t == config::ProblemData::Type::TRANSIENT)
64
- // {
65
- // return (iodata.solver.transient.delta_post > 0);
66
- // }
67
- // else
68
- // {
69
- // return false;
70
- // }
71
- // }
72
-
73
45
} // namespace
74
46
75
47
template <config::ProblemData::Type solver_t >
@@ -78,7 +50,7 @@ PostOperator<solver_t>::PostOperator(const IoData &iodata, fem_op_t<solver_t> &f
78
50
: fem_op(&fem_op_), units(iodata.units), post_dir(iodata.problem.output),
79
51
post_op_csv (this , nr_expected_measurement_rows),
80
52
surf_post_op(iodata, fem_op->GetMaterialOp (), fem_op->GetH1Space()),
81
- // dom_post_op does not have a default ctor so immediately specialize via lambda
53
+ // dom_post_op does not have a default ctor so specialize via immediate lambda.
82
54
dom_post_op(std::move(
83
55
[&iodata, &fem_op_]()
84
56
{
@@ -100,7 +72,7 @@ PostOperator<solver_t>::PostOperator(const IoData &iodata, fem_op_t<solver_t> &f
100
72
}())),
101
73
interp_op(iodata, fem_op->GetNDSpace ())
102
74
{
103
- // Define primary grid-functions
75
+ // Define primary grid-functions.
104
76
if constexpr (HasVGridFunction<solver_t >())
105
77
{
106
78
V = std::make_unique<GridFunction>(fem_op->GetH1Space ());
@@ -120,7 +92,7 @@ PostOperator<solver_t>::PostOperator(const IoData &iodata, fem_op_t<solver_t> &f
120
92
HasComplexGridFunction<solver_t >());
121
93
}
122
94
123
- // Add wave port boundary mode postprocessing when available.
95
+ // Add wave port boundary mode postprocessing, if available.
124
96
if constexpr (std::is_same_v<fem_op_t <solver_t >, SpaceOperator>)
125
97
{
126
98
for (const auto &[idx, data] : fem_op->GetWavePortOp ())
@@ -156,7 +128,7 @@ PostOperator<solver_t>::PostOperator(const IoData &iodata, fem_op_t<solver_t> &f
156
128
}
157
129
InitializeParaviewDataCollection ();
158
130
159
- // Initilize CSV files for measurements
131
+ // Initilize CSV files for measurements.
160
132
post_op_csv.InitializeCSVDataCollection ();
161
133
}
162
134
@@ -414,7 +386,6 @@ void PostOperator<solver_t>::WriteFields(double time, int step)
414
386
415
387
// Given the electric field and magnetic flux density, write the fields to disk for
416
388
// visualization. Write the mesh coordinates in the same units as originally input.
417
- // TODO(phdum): remove conditional now that we have fem_op always?
418
389
mfem::ParMesh &mesh = E ? *E->ParFESpace ()->GetParMesh () : *B->ParFESpace ()->GetParMesh ();
419
390
mesh::DimensionalizeMesh (mesh, mesh_Lc0);
420
391
ScaleGridFunctions (mesh_Lc0, mesh.Dimension (), HasComplexGridFunction<solver_t >(), E, B,
@@ -428,6 +399,7 @@ void PostOperator<solver_t>::WriteFields(double time, int step)
428
399
mesh::NondimensionalizeMesh (mesh, mesh_Lc0);
429
400
ScaleGridFunctions (1.0 / mesh_Lc0, mesh.Dimension (), HasComplexGridFunction<solver_t >(),
430
401
E, B, V, A);
402
+ Mpi::Barrier (fem_op->GetComm ());
431
403
}
432
404
433
405
template <config::ProblemData::Type solver_t >
@@ -446,7 +418,6 @@ void PostOperator<solver_t>::WriteFieldsFinal(const ErrorIndicator *indicator)
446
418
// need for these to be parallel objects, since the data is local to each process and
447
419
// there isn't a need to ever access the element neighbors. We set the time to some
448
420
// non-used value to make the step identifiable within the data collection.
449
- // TODO(phdum): remove conditional now that we have fem_op always?
450
421
mfem::ParMesh &mesh = E ? *E->ParFESpace ()->GetParMesh () : *B->ParFESpace ()->GetParMesh ();
451
422
mesh::DimensionalizeMesh (mesh, mesh_Lc0);
452
423
paraview->SetCycle (paraview->GetCycle () + 1 );
@@ -513,6 +484,7 @@ void PostOperator<solver_t>::WriteFieldsFinal(const ErrorIndicator *indicator)
513
484
paraview->RegisterVCoeffField (name, gf);
514
485
}
515
486
mesh::NondimensionalizeMesh (mesh, mesh_Lc0);
487
+ Mpi::Barrier (fem_op->GetComm ());
516
488
}
517
489
518
490
// Measurements
@@ -879,20 +851,21 @@ void PostOperator<solver_t>::MeasureSurfaceFlux() const
879
851
template <config::ProblemData::Type solver_t >
880
852
void PostOperator<solver_t >::MeasureInterfaceEFieldEnergy() const
881
853
{
882
- // Depends on Capacitive Lumped Port Energy
854
+ // Depends on Lumped Port Energy since this is used in normalization of participation
855
+ // ratio.
883
856
884
857
// Compute the surface dielectric participation ratio and associated quality factor for
885
858
// the material interface given by index idx. We have:
886
859
// 1/Q_mj = p_mj tan(δ)_j
887
860
// with:
888
- // p_mj = 1/2 t_j Re{∫_{Γ_j} (ε_j E_m)ᴴ E_m dS} /(E_elec + E_cap).
861
+ // p_mj = 1/2 t_j Re{∫_{Γ_j} (ε_j E_m)ᴴ E_m dS} / (E_elec + E_cap).
889
862
measurement_cache.interface_eps_i .clear ();
890
863
if constexpr (HasEGridFunction<solver_t >())
891
864
{
892
-
893
- // These two must have been measured first .
894
- // E_cap returns zero if the solver does not support lumped ports.
895
- // TODO: Shold this not include other types of energy too (surface impedance case)?
865
+ // Domain and port energies must have been measured first. E_cap returns zero if the
866
+ // solver does not support lumped ports .
867
+ //
868
+ // TODO: Should this not include other types of energy too (surface impedance case)?
896
869
auto energy_electric_all = measurement_cache.domain_E_field_energy_all +
897
870
measurement_cache.lumped_port_capacitor_energy ;
898
871
@@ -920,6 +893,7 @@ void PostOperator<solver_t>::MeasureProbes() const
920
893
measurement_cache.probe_E_field .clear ();
921
894
measurement_cache.probe_B_field .clear ();
922
895
896
+ #if defined(MFEM_USE_GSLIB)
923
897
if constexpr (HasEGridFunction<solver_t >())
924
898
{
925
899
if (interp_op.GetProbes ().size () > 0 )
@@ -936,6 +910,7 @@ void PostOperator<solver_t>::MeasureProbes() const
936
910
units.Dimensionalize <Units::ValueType::FIELD_B>(interp_op.ProbeField (*B));
937
911
}
938
912
}
913
+ #endif
939
914
}
940
915
941
916
using fmt::format;
@@ -949,7 +924,6 @@ auto PostOperator<solver_t>::MeasurePrintAll(int step, const ComplexVector &e,
949
924
-> std::enable_if_t <U == config::ProblemData::Type::DRIVEN, double >
950
925
{
951
926
BlockTimer bt0 (Timer::POSTPRO);
952
-
953
927
auto freq = units.Dimensionalize <Units::ValueType::FREQUENCY>(omega);
954
928
SetEGridFunction (e);
955
929
SetBGridFunction (b);
@@ -963,7 +937,7 @@ auto PostOperator<solver_t>::MeasurePrintAll(int step, const ComplexVector &e,
963
937
if (write_paraview_fields () && (step % paraview_delta_post == 0 ))
964
938
{
965
939
Mpi::Print (" \n " );
966
- WriteFields (step / paraview_delta_post, freq_re);
940
+ WriteFields (double ( step) / paraview_delta_post, freq_re);
967
941
Mpi::Print (" Wrote fields to disk at step {:d}\n " , step + 1 );
968
942
}
969
943
double total_energy = units.NonDimensionalize <Units::ValueType::ENERGY>(
@@ -981,7 +955,6 @@ auto PostOperator<solver_t>::MeasurePrintAll(int step, const ComplexVector &e,
981
955
-> std::enable_if_t <U == config::ProblemData::Type::EIGENMODE, double >
982
956
{
983
957
BlockTimer bt0 (Timer::POSTPRO);
984
-
985
958
auto freq = units.Dimensionalize <Units::ValueType::FREQUENCY>(omega);
986
959
SetEGridFunction (e);
987
960
SetBGridFunction (b);
@@ -995,8 +968,8 @@ auto PostOperator<solver_t>::MeasurePrintAll(int step, const ComplexVector &e,
995
968
measurement_cache.error_bkwd = error_bkwd;
996
969
997
970
// Mini pretty-print table of eig summaries: always print with header since other
998
- // measurements may log their results. TODO(phdum+hughcars): Discuss.
999
- if (Mpi::Root (GetComm ()))
971
+ // measurements may log their results.
972
+ if (Mpi::Root (fem_op-> GetComm ()))
1000
973
{
1001
974
Table table;
1002
975
int idx_pad = 1 + static_cast <int >(std::log10 (num_conv));
@@ -1085,7 +1058,6 @@ auto PostOperator<solver_t>::MeasurePrintAll(int step, const Vector &e, const Ve
1085
1058
-> std::enable_if_t <U == config::ProblemData::Type::TRANSIENT, double >
1086
1059
{
1087
1060
BlockTimer bt0 (Timer::POSTPRO);
1088
-
1089
1061
auto time = units.Dimensionalize <Units::ValueType::TIME>(t);
1090
1062
SetEGridFunction (e);
1091
1063
SetBGridFunction (b);
@@ -1098,7 +1070,7 @@ auto PostOperator<solver_t>::MeasurePrintAll(int step, const Vector &e, const Ve
1098
1070
if (write_paraview_fields () && (step % paraview_delta_post == 0 ))
1099
1071
{
1100
1072
Mpi::Print (" \n " );
1101
- WriteFields (step / paraview_delta_post, time);
1073
+ WriteFields (double ( step) / paraview_delta_post, time);
1102
1074
Mpi::Print (" Wrote fields to disk at step {:d}\n " , step + 1 );
1103
1075
}
1104
1076
double total_energy = units.NonDimensionalize <Units::ValueType::ENERGY>(
@@ -1144,7 +1116,8 @@ template class PostOperator<config::ProblemData::Type::ELECTROSTATIC>;
1144
1116
template class PostOperator <config::ProblemData::Type::MAGNETOSTATIC>;
1145
1117
template class PostOperator <config::ProblemData::Type::TRANSIENT>;
1146
1118
1147
- // Function explict instation (TODO(C++20): with requires, we won't need a second template)
1119
+ // Function explict instantiation.
1120
+ // TODO(C++20): with requires, we won't need a second template
1148
1121
1149
1122
template auto PostOperator<config::ProblemData::Type::DRIVEN>::MeasurePrintAll<
1150
1123
config::ProblemData::Type::DRIVEN>(int step, const ComplexVector &e,
0 commit comments