47 double x =
p(0), y =
p(1);
75 double x =
p(0), y =
p(1);
76 double alpha = 1000.0;
77 double xc = 0.75, yc = 0.5;
79 double r = sqrt(pow(x - xc,2.0) + pow(y - yc,2.0));
80 double num = - ( alpha - pow(alpha,3) * (pow(r,2) - pow(r0,2)) );
81 double denom = pow(r * ( pow(alpha,2) * pow(r0,2) + pow(alpha,2) * pow(r,2) \
82 - 2 * pow(alpha,2) * r0 * r + 1.0 ),2);
83 denom = max(denom,1e-8);
87 int main(
int argc,
char *argv[])
90 Mpi::Init(argc, argv);
91 int num_procs = Mpi::WorldSize();
92 int myid = Mpi::WorldRank();
96 const char *mesh_file =
"../data/star.mesh";
100 double double_max_elems = double(max_elems);
101 bool visualization =
true;
102 bool nc_simplices =
true;
103 double osc_threshold = 1e-3;
104 int enriched_order = 5;
107 args.
AddOption(&mesh_file,
"-m",
"--mesh",
108 "Mesh file to use.");
110 "Finite element order (polynomial degree).");
111 args.
AddOption(&nc_limit,
"-l",
"--nc-limit",
112 "Maximum level of hanging nodes.");
113 args.
AddOption(&double_max_elems,
"-me",
"--max-elems",
114 "Stop after reaching this many elements.");
115 args.
AddOption(&osc_threshold,
"-e",
"--error",
116 "relative data oscillation threshold.");
117 args.
AddOption(&enriched_order,
"-eo",
"--enriched_order",
118 "Enriched quadrature order.");
119 args.
AddOption(&nc_simplices,
"-ns",
"--nonconforming-simplices",
120 "-cs",
"--conforming-simplices",
121 "For simplicial meshes, enable/disable nonconforming"
123 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
124 "--no-visualization",
125 "Enable or disable GLVis visualization.");
140 max_elems = int(double_max_elems);
141 Mesh mesh(mesh_file, 1, 1);
148 for (
int i = 0; i < 2; i++)
163 ParMesh pmesh(MPI_COMM_WORLD, mesh);
178 sol_sock.
open(vishost, visport);
183 int order_quad = 2*order + enriched_order;
184 for (
int i = 0; i < Geometry::NumGeom; ++i)
202 double osc = coeffrefiner.
GetOsc();
207 mfem::out <<
"Number of Elements " << globalNE <<
"\n";
208 mfem::out <<
"Osc error " << osc <<
"\n";
216 osc = coeffrefiner.
GetOsc();
220 mfem::out <<
"Function 1 (discontinuous) \n";
221 mfem::out <<
"Number of Elements " << globalNE <<
"\n";
222 mfem::out <<
"Osc error " << osc <<
"\n";
230 osc = coeffrefiner.
GetOsc();
235 mfem::out <<
"Number of Elements " << globalNE <<
"\n";
236 mfem::out <<
"Osc error " << osc <<
"\n";
241 sol_sock.precision(8);
242 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
243 sol_sock <<
"mesh\n" << pmesh << flush;
Class for an integration rule - an Array of IntegrationPoint.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
double jump_function(const Vector &p)
void ResetCoefficient(Coefficient &coeff_)
Reset the function f.
double singular_function(const Vector &p)
void SetIntRule(const IntegrationRule *irs_[])
virtual int PreprocessMesh(Mesh &mesh, int max_it)
Apply the operator to the mesh max_it times or until tolerance achieved.
void SetMaxElements(long long max_elements_)
Set the maximum number of elements stopping criterion: stop when the input mesh has num_elements >= m...
double Normlp(double p) const
Returns the l_p norm of the vector.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void EnsureNCMesh(bool simplices_nonconforming=false)
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
void SetNCLimit(int nc_limit_)
Set the maximum ratio of refinement levels of adjacent elements (0 = unlimited). The default value is...
void PrintUsage(std::ostream &out) const
Print the usage message.
double p(const Vector &x, double t)
Refinement operator to control data oscillation.
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...
double affine_function(const Vector &p)
NURBSExtension * NURBSext
Optional NURBS mesh extension.
void SetThreshold(double threshold_)
Set the refinement threshold. The default value is 1.0e-2.
long long GetGlobalNE() const
Return the total (global) number of elements.
void PrintOptions(std::ostream &out) const
Print the options.
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
void Clear()
Clear the contents of the Mesh.
A general function coefficient.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
Class for parallel meshes.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
bool Good() const
Return true if the command line options were parsed successfully.