43 MFEM_VERIFY(offset < 0.9,
"offset is too large!");
52 vc[0] = 0.0; vc[1] = 0.0;
54 vc[0] = 1.0; vc[1] = 0.0;
56 vc[0] = offset; vc[1] = 1.0;
58 vc[0] = 1.0; vc[1] = 1.0;
63 vert[0] = 0; vert[1] = 1; vert[2] = 3; vert[3] = 2;
82int main(
int argc,
char *argv[])
85 cout <<
"\nAs of mfem-4.3 and hypre-2.22.0 (July 2021) this example\n"
86 <<
"is NOT supported with the GPU version of hypre.\n\n";
87 return MFEM_SKIP_RETURN_VALUE;
98 bool visualization = 1;
99 bool reorder_space =
false;
106 "Finite element order (polynomial degree).");
107 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
108 "--no-visualization",
109 "Enable or disable GLVis visualization.");
110 args.
AddOption(&reorder_space,
"-nodes",
"--by-nodes",
"-vdim",
"--by-vdim",
111 "Use byNODES ordering of vector space instead of byVDIM");
112 args.
AddOption(&offset,
"--offset",
"--offset",
113 "How much to offset the trapezoid.");
114 args.
AddOption(&visit,
"-visit",
"--visit-datafiles",
"-no-visit",
115 "--no-visit-datafiles",
116 "Save data files for VisIt (visit.llnl.gov) visualization.");
117 args.
AddOption(&penalty,
"-p",
"--penalty",
118 "Penalty parameter; 0 means use elimination solver.");
144 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
145 for (
int l = 0; l < ref_levels; l++)
157 int par_ref_levels = 1;
158 for (
int l = 0; l < par_ref_levels; l++)
172 const bool use_nodal_fespace = pmesh->
NURBSext;
173 if (use_nodal_fespace)
193 cout <<
"Number of finite element unknowns: " << size << endl
194 <<
"Assembling matrix and r.h.s... " << flush;
214 for (
int i = 0; i <
dim-1; i++)
223 push_force(1) = -5.0e-2;
259 a->FormLinearSystem(ess_tdof_list, x, *
b, A, X, B);
262 cout <<
"done." << endl;
269 constraint_atts[0] = 1;
270 constraint_atts[1] = 4;
274 constraint_rowstarts);
283 constraint_rowstarts,
dim,
299 a->RecoverFEMSolution(X, *
b, x);
308 if (!use_nodal_fespace)
331 ostringstream mesh_name, sol_name;
332 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
333 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
335 ofstream mesh_ofs(mesh_name.str().c_str());
336 mesh_ofs.precision(8);
337 pmesh->
Print(mesh_ofs);
339 ofstream sol_ofs(sol_name.str().c_str());
340 sol_ofs.precision(8);
351 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
352 sol_sock.precision(8);
353 sol_sock <<
"solution\n" << *pmesh << x << flush;
357 delete local_constraints;
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
A coefficient that is constant across space and time.
An abstract class to solve the constrained system subject to the constraint .
virtual void Mult(const Vector &f, Vector &x) const override
Solve for given .
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
Class for grid function - Vector with associated FE space.
Arbitrary order H1-conforming (continuous) finite elements.
Wrapper for hypre's ParCSR matrix class.
HYPRE_BigInt GetGlobalNumRows() const
Return the global number of rows.
static void Init()
Initialize hypre by calling HYPRE_Init() and set default options. After calling Hypre::Init(),...
void SetRelTol(real_t rtol)
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
void SetMaxIter(int max_it)
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
int AddQuad(int v1, int v2, int v3, int v4, int attr=1)
Adds a quadrilateral to the mesh given by 4 vertices v1 through v4.
int AddVertex(real_t x, real_t y=0.0, real_t z=0.0)
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
int AddBdrSegment(int v1, int v2, int attr=1)
void FinalizeQuadMesh(int generate_edges=0, int refine=0, bool fix_orientation=true)
Finalize the construction of a quadrilateral Mesh.
void GetNodes(Vector &node_coord) const
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Array< int > attributes
A list of all unique element attributes used by the Mesh.
static int WorldRank()
Return the MPI rank in MPI_COMM_WORLD.
static int WorldSize()
Return the size of MPI_COMM_WORLD.
static void Init(int &argc, char **&argv, int required=default_thread_required, int *provided=nullptr)
Singleton creation with Mpi::Init(argc, argv).
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
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...
bool Good() const
Return true if the command line options were parsed successfully.
A piecewise constant coefficient with the constants keyed off the element attribute numbers.
Abstract parallel finite element space.
void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1) const override
HYPRE_BigInt GlobalTrueVSize() const
Class for parallel grid function.
void Save(std::ostream &out) const override
Class for parallel meshes.
void SetNodalFESpace(FiniteElementSpace *nfes) override
void Print(std::ostream &out=mfem::out, const std::string &comments="") const override
Vector coefficient defined by an array of scalar coefficients. Coefficients that are not set will eva...
Vector & Set(const real_t a, const Vector &x)
(*this) = a * x
Data collection with VisIt I/O routines.
void SetLevelsOfDetail(int levels_of_detail)
Set VisIt parameter: default levels of detail for the MultiresControl.
virtual void Save() override
Save the collection and a VisIt root file.
virtual void RegisterField(const std::string &field_name, GridFunction *gf) override
Add a grid function to the collection and update the root file.
Mesh * build_trapezoid_mesh(real_t offset)
constexpr int dimension
This example only works in 3D. Kernels for 2D are not implemented.
SparseMatrix * ParBuildNormalConstraints(ParFiniteElementSpace &fespace, Array< int > &constrained_att, Array< int > &constraint_rowstarts)
Parallel wrapper for BuildNormalConstraints.
std::function< real_t(const Vector &)> f(real_t mass_coeff)