141 #include "../common/mfem-common.hpp" 146 using namespace mfem;
177 std::vector<complex<double>> &E);
180 std::vector<complex<double>> &curlE);
183 std::vector<complex<double>> &curlcurlE);
202 static const char *enum_str[] =
207 "pml_plane_wave_scatter",
213 int main(
int argc,
char *argv[])
216 int myid = Mpi::WorldRank();
219 const char *mesh_file =
"../../data/inline-quad.mesh";
224 bool static_cond =
false;
229 bool with_pml =
false;
230 bool visualization =
true;
231 bool paraview =
false;
234 args.
AddOption(&mesh_file,
"-m",
"--mesh",
235 "Mesh file to use.");
237 "Finite element order (polynomial degree)");
238 args.
AddOption(&rnum,
"-rnum",
"--number-of-wavelengths",
239 "Number of wavelengths");
241 "Permeability of free space (or 1/(spring constant)).");
243 "Permittivity of free space (or mass constant).");
244 args.
AddOption(&iprob,
"-prob",
"--problem",
"Problem case" 245 " 0: plane wave, 1: Fichera 'oven', " 246 " 2: Generic PML problem with point source given as a load " 247 " 3: Scattering of a plane wave, " 248 " 4: Point source given on the boundary");
249 args.
AddOption(&delta_order,
"-do",
"--delta-order",
250 "Order enrichment for DPG test space.");
251 args.
AddOption(&theta,
"-theta",
"--theta",
252 "Theta parameter for AMR");
253 args.
AddOption(&sr,
"-sref",
"--serial-ref",
254 "Number of parallel refinements.");
255 args.
AddOption(&pr,
"-pref",
"--parallel-ref",
256 "Number of parallel refinements.");
257 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
258 "--no-static-condensation",
"Enable static condensation.");
259 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
260 "--no-visualization",
261 "Enable or disable GLVis visualization.");
262 args.
AddOption(¶view,
"-paraview",
"--paraview",
"-no-paraview",
264 "Enable or disable ParaView visualization.");
275 if (iprob > 4) { iprob = 0; }
277 omega = 2.*M_PI*rnum;
285 mesh_file =
"meshes/fichera-waveguide.mesh";
287 rnum =
omega/(2.*M_PI);
296 mesh_file =
"meshes/scatter.mesh";
304 Mesh mesh(mesh_file, 1, 1);
306 MFEM_VERIFY(
dim > 1,
"Dimension = 1 is not supported in this example");
310 for (
int i = 0; i<sr; i++)
325 ParMesh pmesh(MPI_COMM_WORLD, mesh);
358 int test_order = order+delta_order;
379 trial_fes.
Append(hatE_fes);
380 trial_fes.
Append(hatH_fes);
394 rot_mat(0,0) = 0.; rot_mat(0,1) = 1.;
395 rot_mat(1,0) = -1.; rot_mat(1,1) = 0.;
422 epsomeg_cf = &epsomeg;
423 negepsomeg_cf = &negepsomeg;
424 eps2omeg2_cf = &eps2omeg2;
426 negmuomeg_cf = &negmuomeg;
427 mu2omeg2_cf = &mu2omeg2;
429 negepsrot_cf = &negepsrot;
456 abs_detJ_Jt_J_inv_2);
458 abs_detJ_Jt_J_inv_2);
465 epsomeg_detJ_Jt_J_inv_i,attrPML);
467 epsomeg_detJ_Jt_J_inv_r,attrPML);
469 negepsomeg_detJ_Jt_J_inv_r,attrPML);
473 negmuomeg_detJ_Jt_J_inv_i,attrPML);
475 negmuomeg_detJ_Jt_J_inv_r,attrPML);
477 mu2omeg2_detJ_Jt_J_inv_2,attrPML);
479 eps2omeg2_detJ_Jt_J_inv_2,attrPML);
491 epsomeg_detJ_Jt_J_inv_i, rot);
493 epsomeg_detJ_Jt_J_inv_r, rot);
495 negepsomeg_detJ_Jt_J_inv_r, rot);
497 *epsomeg_detJ_Jt_J_inv_i_rot, attrPML);
499 *epsomeg_detJ_Jt_J_inv_r_rot, attrPML);
501 *negepsomeg_detJ_Jt_J_inv_r_rot, attrPML);
509 nullptr,TrialSpace::E_space, TestSpace::F_space);
511 a->AddTrialIntegrator(
nullptr,
513 TrialSpace::E_space,TestSpace::G_space);
516 nullptr,TrialSpace::H_space, TestSpace::G_space);
519 TrialSpace::hatH_space, TestSpace::G_space);
523 TestSpace::G_space,TestSpace::G_space);
526 TestSpace::G_space,TestSpace::G_space);
533 TrialSpace::H_space,TestSpace::F_space);
536 TrialSpace::hatE_space, TestSpace::F_space);
541 TestSpace::F_space, TestSpace::F_space);
544 TestSpace::F_space,TestSpace::F_space);
547 TestSpace::F_space, TestSpace::F_space);
550 TestSpace::F_space, TestSpace::G_space);
553 TestSpace::F_space, TestSpace::G_space);
556 TestSpace::G_space, TestSpace::F_space);
559 TestSpace::G_space, TestSpace::F_space);
562 TestSpace::G_space, TestSpace::G_space);
568 TrialSpace::H_space, TestSpace::F_space);
571 TrialSpace::hatE_space, TestSpace::F_space);
575 TestSpace::F_space, TestSpace::F_space);
578 TestSpace::F_space, TestSpace::F_space);
581 TestSpace::F_space, TestSpace::F_space);
583 a->AddTestIntegrator(
nullptr,
585 TestSpace::F_space, TestSpace::G_space);
588 TestSpace::F_space, TestSpace::G_space);
591 TestSpace::G_space, TestSpace::F_space);
593 a->AddTestIntegrator(
nullptr,
596 TestSpace::G_space, TestSpace::F_space);
599 TestSpace::G_space, TestSpace::G_space);
606 a->AddTrialIntegrator(
608 epsomeg_detJ_Jt_J_inv_i_restr)),
610 negepsomeg_detJ_Jt_J_inv_r_restr)),
611 TrialSpace::E_space,TestSpace::G_space);
617 a->AddTrialIntegrator(
619 negmuomeg_detJ_Jt_J_inv_i_restr)),
621 muomeg_detJ_Jt_J_inv_r_restr)),
622 TrialSpace::H_space, TestSpace::F_space);
625 a->AddTestIntegrator(
627 TestSpace::F_space, TestSpace::F_space);
632 negmuomeg_detJ_Jt_J_inv_i_restr),
634 TestSpace::F_space,TestSpace::G_space);
638 epsomeg_detJ_Jt_J_inv_i_restr),
640 TestSpace::F_space,TestSpace::G_space);
644 negmuomeg_detJ_Jt_J_inv_i_restr),
646 TestSpace::G_space, TestSpace::F_space);
650 epsomeg_detJ_Jt_J_inv_i_restr),
652 TestSpace::G_space, TestSpace::F_space);
655 eps2omeg2_detJ_Jt_J_inv_2_restr),
nullptr,
656 TestSpace::G_space, TestSpace::G_space);
663 a->AddTrialIntegrator(
666 TrialSpace::H_space, TestSpace::F_space);
669 a->AddTestIntegrator(
new MassIntegrator(mu2omeg2_detJ_2_restr),
nullptr,
670 TestSpace::F_space, TestSpace::F_space);
673 a->AddTestIntegrator(
676 TestSpace::F_space, TestSpace::G_space);
680 *epsomeg_detJ_Jt_J_inv_i_rot_restr),
682 TestSpace::F_space, TestSpace::G_space);
687 TestSpace::G_space, TestSpace::F_space);
690 a->AddTestIntegrator(
692 *epsomeg_detJ_Jt_J_inv_i_rot_restr)),
694 *epsomeg_detJ_Jt_J_inv_r_rot_restr)),
695 TestSpace::G_space, TestSpace::F_space);
698 eps2omeg2_detJ_Jt_J_inv_2_restr),
nullptr,
699 TestSpace::G_space, TestSpace::G_space);
725 std::cout <<
"\n Ref |" 730 std::cout <<
" L2 Error |" 733 std::cout <<
" Residual |" 735 <<
" PCG it |" << endl;
736 std::cout << std::string((
exact_known) ? 82 : 60,
'-')
765 if (static_cond) {
a->EnableStaticCondensation(); }
766 for (
int it = 0; it<=pr; it++)
785 for (
int j = 0; j < ess_tdof_list.
Size(); j++)
808 hatE_gf_i.ProjectBdrCoefficientTangent(hatEex_i, ess_bdr);
813 hatE_gf_i.ProjectBdrCoefficientNormal(hatEex_i, ess_bdr);
819 a->FormLinearSystem(ess_tdof_list,x,Ah, X,B);
830 int skip = (static_cond) ? 0 : 2;
831 int k = (static_cond) ? 2 : 0;
832 for (
int i=0; i<num_blocks; i++)
834 tdof_offsets[i+1] = trial_fes[i+k]->GetTrueVSize();
835 tdof_offsets[num_blocks+i+1] = trial_fes[i+k]->GetTrueVSize();
840 for (
int i = 0; i<num_blocks; i++)
842 for (
int j = 0; j<num_blocks; j++)
844 blockA.
SetBlock(i,j,&BlockA_r->GetBlock(i,j));
846 blockA.
SetBlock(i+num_blocks,j+num_blocks,&BlockA_r->GetBlock(i,j));
857 BlockA_r->GetBlock(0,0));
861 BlockA_r->GetBlock(1,1));
885 dynamic_cast<HypreAMS*
>(solver_hatH)->SetPrintLevel(0);
901 for (
int i = 0; i<num_blocks; i++)
908 a->RecoverFEMSolution(X,x);
910 Vector & residuals =
a->ComputeResidual(x);
912 double residual = residuals.
Norml2();
913 double maxresidual = residuals.
Max();
914 double globalresidual = residual * residual;
915 MPI_Allreduce(MPI_IN_PLACE,&maxresidual,1,MPI_DOUBLE,MPI_MAX,MPI_COMM_WORLD);
916 MPI_Allreduce(MPI_IN_PLACE,&globalresidual,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);
918 globalresidual = sqrt(globalresidual);
923 H_r.
MakeRef(H_fes,x, offsets[1]);
927 for (
int i = 0; i<trial_fes.
Size(); i++)
929 dofs += trial_fes[i]->GlobalTrueVSize();
932 double L2Error = 0.0;
933 double rate_err = 0.0;
945 L2Error = sqrt( E_err_r*E_err_r + E_err_i*E_err_i
946 + H_err_r*H_err_r + H_err_i*H_err_i );
947 rate_err = (it) ?
dim*log(err0/L2Error)/log((
double)dof0/dofs) : 0.0;
951 double rate_res = (it) ?
dim*log(res0/globalresidual)/log((
952 double)dof0/dofs) : 0.0;
954 res0 = globalresidual;
959 std::ios oldState(
nullptr);
960 oldState.copyfmt(std::cout);
961 std::cout << std::right << std::setw(5) << it <<
" | " 962 << std::setw(10) << dof0 <<
" | " 963 << std::setprecision(1) << std::fixed
964 << std::setw(4) << 2.0*rnum <<
" π | " 965 << std::setprecision(3);
968 std::cout << std::setw(10) << std::scientific << err0 <<
" | " 969 << std::setprecision(2)
970 << std::setw(6) << std::fixed << rate_err <<
" | " ;
972 std::cout << std::setprecision(3)
973 << std::setw(10) << std::scientific << res0 <<
" | " 974 << std::setprecision(2)
975 << std::setw(6) << std::fixed << rate_res <<
" | " 976 << std::setw(6) << std::fixed << num_iter <<
" | " 978 std::cout.copyfmt(oldState);
983 const char * keys = (it == 0 &&
dim == 2) ?
"jRcml\n" :
nullptr;
987 "Numerical Electric field (real part)", 0, 0, 500, 500, keys);
989 "Numerical Magnetic field (real part)", 501, 0, 500, 500, keys);
995 paraview_dc->
SetTime((
double)it);
1006 elements_to_refine.
SetSize(0);
1007 for (
int iel = 0; iel<pmesh.
GetNE(); iel++)
1009 if (residuals[iel] > theta * maxresidual)
1011 elements_to_refine.
Append(iel);
1021 for (
int i =0; i<trial_fes.
Size(); i++)
1023 trial_fes[i]->Update(
false);
1028 if (pml &&
dim == 2)
1030 delete epsomeg_detJ_Jt_J_inv_i_rot;
1031 delete epsomeg_detJ_Jt_J_inv_r_rot;
1032 delete negepsomeg_detJ_Jt_J_inv_r_rot;
1033 delete epsomeg_detJ_Jt_J_inv_i_rot_restr;
1034 delete epsomeg_detJ_Jt_J_inv_r_rot_restr;
1035 delete negepsomeg_detJ_Jt_J_inv_r_rot_restr;
1060 std::vector<std::complex<double>> E;
1063 for (
unsigned i = 0; i < E.size(); i++)
1065 E_r[i]= E[i].real();
1071 std::vector<std::complex<double>> E;
1074 for (
unsigned i = 0; i < E.size(); i++)
1076 E_i[i]= E[i].imag();
1082 std::vector<std::complex<double>> curlE;
1084 curlE_r.
SetSize(curlE.size());
1085 for (
unsigned i = 0; i < curlE.size(); i++)
1087 curlE_r[i]= curlE[i].real();
1093 std::vector<std::complex<double>> curlE;
1095 curlE_i.
SetSize(curlE.size());
1096 for (
unsigned i = 0; i < curlE.size(); i++)
1098 curlE_i[i]= curlE[i].imag();
1104 std::vector<std::complex<double>> curlcurlE;
1106 curlcurlE_r.
SetSize(curlcurlE.size());
1107 for (
unsigned i = 0; i < curlcurlE.size(); i++)
1109 curlcurlE_r[i]= curlcurlE[i].real();
1115 std::vector<std::complex<double>> curlcurlE;
1117 curlcurlE_i.
SetSize(curlcurlE.size());
1118 for (
unsigned i = 0; i < curlcurlE.size(); i++)
1120 curlcurlE_i[i]= curlcurlE[i].imag();
1132 for (
int i = 0; i<
dimc; i++)
1134 H_r(i) = - curlE_i(i) / (
omega *
mu);
1145 for (
int i = 0; i<
dimc; i++)
1147 H_i(i) = curlE_r(i) / (
omega *
mu);
1157 for (
int i = 0; i<
dim; i++)
1159 curlH_r(i) = -curlcurlE_i(i) / (
omega *
mu);
1169 for (
int i = 0; i<
dim; i++)
1171 curlH_i(i) = curlcurlE_r(i) / (
omega *
mu);
1188 hatE_r[1] = -E_r[0];
1205 hatE_i[1] = -E_i[0];
1242 for (
int i = 0; i<
dim; i++)
1255 for (
int i = 0; i<
dim; i++)
1263 complex<double> zi = complex<double>(0., 1.);
1265 for (
int i = 0; i <
dim; ++i)
1273 E[0] = exp(zi *
omega * (X.
Sum()));
1278 E[1] = exp(zi *
omega * (X(0)));
1283 if (abs(X(2) - 3.0) < 1e-10)
1285 E[0] = sin(M_PI*X(1));
1297 double x0 = X(0) + shift(0);
1298 double x1 = X(1) + shift(1);
1299 double r = sqrt(x0 * x0 + x1 * x1);
1300 double beta = k * r;
1303 complex<double> Ho, Ho_r, Ho_rr;
1304 Ho = jn(0,
beta) + zi * yn(0,
beta);
1305 Ho_r = -k * (jn(1,
beta) + zi * yn(1,
beta));
1306 Ho_rr = -k * k * (1.0 /
beta *
1311 double r_x = x0 / r;
1312 double r_y = x1 / r;
1313 double r_xy = -(r_x / r) * r_y;
1314 double r_xx = (1.0 / r) * (1.0 - r_x * r_x);
1316 complex<double> val, val_xx, val_xy;
1317 val = 0.25 * zi * Ho;
1318 val_xx = 0.25 * zi * (r_xx * Ho_r + r_x * r_x * Ho_rr);
1319 val_xy = 0.25 * zi * (r_xy * Ho_r + r_x * r_y * Ho_rr);
1320 E[0] = zi / k * (k * k * val + val_xx);
1321 E[1] = zi / k * val_xy;
1325 double x0 = X(0) + shift(0);
1326 double x1 = X(1) + shift(1);
1327 double x2 = X(2) + shift(2);
1328 double r = sqrt(x0 * x0 + x1 * x1 + x2 * x2);
1330 double r_x = x0 / r;
1331 double r_y = x1 / r;
1332 double r_z = x2 / r;
1333 double r_xx = (1.0 / r) * (1.0 - r_x * r_x);
1334 double r_yx = -(r_y / r) * r_x;
1335 double r_zx = -(r_z / r) * r_x;
1337 complex<double> val, val_r, val_rr;
1338 val = exp(zi * k * r) / r;
1339 val_r = val / r * (zi * k * r - 1.0);
1340 val_rr = val / (r * r) * (-k * k * r * r
1341 - 2.0 * zi * k * r + 2.0);
1343 complex<double> val_xx, val_yx, val_zx;
1344 val_xx = val_rr * r_x * r_x + val_r * r_xx;
1345 val_yx = val_rr * r_x * r_y + val_r * r_yx;
1346 val_zx = val_rr * r_x * r_z + val_r * r_zx;
1347 complex<double>
alpha = zi * k / 4.0 / M_PI / k / k;
1348 E[0] =
alpha * (k * k * val + val_xx);
1349 E[1] =
alpha * val_yx;
1350 E[2] =
alpha * val_zx;
1356 MFEM_ABORT(
"Should be unreachable");
1362 std::vector<complex<double>> &curlE)
1364 complex<double> zi = complex<double>(0., 1.);
1366 for (
int i = 0; i <
dimc; ++i)
1374 std::complex<double> pw = exp(zi *
omega * (X.
Sum()));
1378 curlE[1] = zi *
omega * pw;
1379 curlE[2] = -zi *
omega * pw;
1383 curlE[0] = -zi *
omega * pw;
1389 std::complex<double> pw = exp(zi *
omega * (X(0)));
1390 curlE[0] = zi *
omega * pw;
1394 MFEM_ABORT(
"Should be unreachable");
1400 std::vector<complex<double>> &curlcurlE)
1402 complex<double> zi = complex<double>(0., 1.);
1403 curlcurlE.resize(
dim);
1404 for (
int i = 0; i <
dim; ++i)
1406 curlcurlE[i] = 0.0;;
1412 std::complex<double> pw = exp(zi *
omega * (X.
Sum()));
1428 std::complex<double> pw = exp(zi *
omega * (X(0)));
1433 MFEM_ABORT(
"Should be unreachable");
1443 for (
int i = 0; i <
dim; ++i)
1445 r += pow(x[i] - center[i], 2.);
1448 double coeff = pow(n, 2) / M_PI;
1449 double alpha = -pow(n, 2) * r;
void curlE_exact_r(const Vector &x, Vector &curlE_r)
A matrix coefficient that is constant in space and time.
Matrix coefficient defined as the product of two matrices.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
Conjugate gradient method.
virtual Operator & real()
Real or imaginary part accessor methods.
The Auxiliary-space Maxwell Solver in hypre.
void maxwell_solution(const Vector &X, std::vector< complex< double >> &E)
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
void SetDataFormat(VTKFormat fmt)
A coefficient that is constant across space and time.
void PrintOptions(std::ostream &out) const
Print the options.
int Dimension() const
Dimension of the reference space used within the elements.
void SetSize(int s)
Resize the vector to size s.
Mimic the action of a complex operator using two real operators.
Helper class for ParaView visualization data.
int NumRowBlocks() const
Return the number of row blocks.
void PrintUsage(std::ostream &out) const
Print the usage message.
Integrator for (curl u, curl v) for Nedelec elements.
void rhs_func_r(const Vector &x, Vector &J_r)
Pointer to an Operator of a specified type.
Scalar coefficient defined as the product of two scalar coefficients or a scalar and a scalar coeffic...
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
int Size() const
Returns the size of the vector.
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
Data type dense matrix using column-major storage.
bool Good() const
Return true if the command line options were parsed successfully.
Abstract parallel finite element space.
double hatH_exact_scalar_i(const Vector &X)
Matrix coefficient defined as a product of a scalar coefficient and a matrix coefficient.
void maxwell_solution_curlcurl(const Vector &X, std::vector< complex< double >> &curlcurlE)
void SetOmega(double omega_)
void curlE_exact_i(const Vector &x, Vector &curlE_i)
void abs_detJ_Jt_J_inv_2_function(const Vector &x, CartesianPML *pml, DenseMatrix &M)
double hatH_exact_scalar_r(const Vector &X)
Operator & GetBlock(int i, int j)
Return a reference to block i,j.
void curlcurlE_exact_r(const Vector &x, Vector &curlcurlE_r)
void detJ_Jt_J_inv_r_function(const Vector &x, CartesianPML *pml, DenseMatrix &M)
void maxwell_solution_curl(const Vector &X, std::vector< complex< double >> &curlE)
double detJ_i_function(const Vector &x, CartesianPML *pml)
void curlcurlE_exact_i(const Vector &x, Vector &curlcurlE_i)
Operator & GetDiagonalBlock(int iblock)
Return a reference to block i,i.
virtual void MakeRef(FiniteElementSpace *f, double *v)
Make the ParGridFunction reference external data on a new FiniteElementSpace.
The BoomerAMG solver in hypre.
void ProjectBdrCoefficientNormal(VectorCoefficient &vcoeff, Array< int > &bdr_attr)
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
void rhs_func_i(const Vector &x, Vector &J_i)
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
A class to handle Block diagonal preconditioners in a matrix-free implementation. ...
int Append(const T &el)
Append element 'el' to array, resize if necessary.
void EnsureNCMesh(bool simplices_nonconforming=false)
Derived coefficient that takes the value of the parent coefficient for the active attributes and is z...
int GetNumIterations() const
Returns the number of iterations taken during the last call to Mult()
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Arbitrary order "H^{1/2}-conforming" trace finite elements defined on the interface between mesh elem...
void SetPrintLevel(int print_level)
Arbitrary order H(curl)-trace finite elements defined on the interface between mesh elements (faces...
void SetMaxIter(int max_it)
double Sum() const
Return the sum of the vector entries.
void source_function(const Vector &x, Vector &f)
void SetAttributes(Mesh *mesh_, Array< int > *attrNonPML=nullptr, Array< int > *attrPML=nullptr)
Mark element in the PML region.
double abs_detJ_2_function(const Vector &x, CartesianPML *pml)
void hatH_exact_r(const Vector &X, Vector &hatH_r)
void SetHighOrderOutput(bool high_order_output_)
void E_exact_i(const Vector &x, Vector &E_i)
void SetEpsilonAndMu(double epsilon_, double mu_)
void VisualizeField(socketstream &sock, const char *vishost, int visport, ParGridFunction &gf, const char *title, int x=0, int y=0, int w=400, int h=400, bool vec=false)
void SetTime(double t)
Set physical time (for time-dependent simulations)
virtual double ComputeL2Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const
void detJ_Jt_J_inv_i_function(const Vector &x, CartesianPML *pml, DenseMatrix &M)
A general vector function coefficient.
void H_exact_i(const Vector &x, Vector &H_i)
void H_exact_r(const Vector &x, Vector &H_r)
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
void SetRelTol(double rtol)
void hatE_exact_r(const Vector &X, Vector &hatE_r)
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
void SetPrintLevel(int print_lvl)
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
void PartialSum()
Fill the entries of the array with the cumulative sum of the entries.
Base class for Matrix Coefficients that optionally depend on time and space.
virtual Operator & imag()
double Max() const
Returns the maximal element of the vector.
void curlH_exact_i(const Vector &x, Vector &curlH_i)
void E_exact_r(const Vector &x, Vector &E_r)
Derived matrix coefficient that has the value of the parent matrix coefficient where it is active and...
int GetNE() const
Returns number of elements.
double detJ_r_function(const Vector &x, CartesianPML *pml)
PML stretching functions: See https://doi.org/10.1006/jcph.1994.1159.
virtual int GetTrueVSize() const
Return the number of local vector true dofs.
Class for setting up a simple Cartesian PML region.
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get()...
int main(int argc, char *argv[])
void curlH_exact_r(const Vector &x, Vector &curlH_r)
virtual void ProjectBdrCoefficientTangent(VectorCoefficient &vcoeff, Array< int > &bdr_attr)
Project the tangential components of the given VectorCoefficient on the boundary. Only boundary attri...
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
double Norml2() const
Returns the l2 norm of the vector.
Abstract class for hypre's solvers and preconditioners.
void hatH_exact_i(const Vector &X, Vector &hatH_i)
int Size() const
Return the logical size of the array.
T & Last()
Return the last element in the array.
void SetLevelsOfDetail(int levels_of_detail_)
void Clear()
Clear the contents of the Mesh.
for VectorFiniteElements (Nedelec, Raviart-Thomas)
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
Arbitrary order H(curl)-conforming Nedelec finite elements.
Arbitrary order "H^{-1/2}-conforming" face finite elements defined on the interface between mesh elem...
void SetSystemsOptions(int dim, bool order_bynodes=false)
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
Arbitrary order H1-conforming (continuous) finite elements.
virtual void Save() override
Class for parallel grid function.
Wrapper for hypre's ParCSR matrix class.
A class to handle Block systems in a matrix-free implementation.
void GeneralRefinement(const Array< Refinement > &refinements, int nonconforming=-1, int nc_limit=0)
Class for parallel meshes.
void hatE_exact_i(const Vector &X, Vector &hatE_i)
void SetPrefixPath(const std::string &prefix)
Set the path where the DataCollection will be saved.
void SetBlock(int iRow, int iCol, Operator *op, double c=1.0)
Add a block op in the block-entry (iblock, jblock).
void SetDiagonalBlock(int iblock, Operator *op)
Add a square block op in the block-entry (iblock, iblock).
Arbitrary order "L2-conforming" discontinuous finite elements.
double f(const Vector &p)