169 const unsigned char requested_dim =
175 Mesh old_mesh(
init.comm(), requested_dim);
177 const std::string meshname =
180 libMesh::out <<
"Reading mesh " << meshname << std::endl;
181 old_mesh.read(meshname);
183 const std::string matname =
188 libMesh::out <<
"Reading matrix " << matname << std::endl;
194 matrix->
read(matname);
195 matrix->get_transpose(*matrix);
197 old_mesh.copy_constraint_rows(*matrix);
201 old_mesh.print_info();
204 if (old_mesh.is_serial_on_zero())
211 libMesh::out <<
"Mesh has " << n_components <<
" connected components." << std::endl;
214 const std::string solnname =
222 const std::string calcfunc =
225 const std::string family =
230 std::unique_ptr<FEMFunctionBase<Number>> goal_function;
234 libMesh::out <<
"Reading solution " << solnname << std::endl;
236 old_es.read(solnname,
237 EquationSystems::READ_HEADER |
238 EquationSystems::READ_DATA |
239 EquationSystems::READ_ADDITIONAL_DATA |
240 EquationSystems::READ_BASIC_ONLY);
244 const unsigned int sysnum =
247 libmesh_assert_less(sysnum, old_es.n_systems());
249 System & old_sys = old_es.get_system(sysnum);
254 std::make_unique<ParsedFEMFunction<Number>>(old_sys, calcfunc);
266 dummy_sys.
add_variable(
"dummy", static_cast<Order>(order),
267 Utility::string_to_enum<FEFamily>(family));
280 std::vector<libMesh::subdomain_id_type> subdomain_vec;
282 std::set<libMesh::subdomain_id_type> subdomains_list(subdomain_vec.begin(),
283 subdomain_vec.end());
285 std::string default_outsolnname =
"out_soln.xda";
287 default_outsolnname =
"out_"+solnname;
288 const std::string outsolnname =
292 libMesh::out << std::setprecision(std::numeric_limits<Real>::max_digits10);
297 Mesh new_mesh(
init.comm(), requested_dim);
298 new_mesh.
read(meshname);
309 std::make_unique<SteadySolver>(new_sys);
326 solver.
quiet =
false;
335 const unsigned int error_q =
342 exact_sol.attach_exact_value(0, goal_function.get());
344 exact_sol.attach_exact_deriv(0, &fdm_gradient);
345 exact_sol.extra_quadrature_order(error_q);
374 const unsigned int jump_error_hilbert =
379 std::unique_ptr<JumpErrorEstimator> error_estimator;
385 if (jump_error_hilbert == 0)
387 error_estimator = std::make_unique<DiscontinuityMeasure>();
390 else if (jump_error_hilbert == 1)
392 error_estimator = std::make_unique<KellyErrorEstimator>();
395 else if (jump_error_hilbert == 2)
397 error_estimator = std::make_unique<LaplacianErrorEstimator>();
401 libmesh_not_implemented();
404 error_estimator->integrate_slits =
true;
407 error_estimator->error_norm = error_norm;
408 error_estimator->estimate_error(new_sys, error_per_cell);
416 for (
auto cell_error : error_per_cell)
417 total_error += cell_error;
419 libMesh::out <<
"H" << jump_error_hilbert <<
" error estimate for " << var_name <<
": " <<
420 total_error << std::endl;
425 new_es.write(outsolnname.c_str(),
426 EquationSystems::WRITE_DATA |
427 EquationSystems::WRITE_ADDITIONAL_DATA);
428 libMesh::out <<
"Wrote solution " << outsolnname << std::endl;
436 (old_mesh.active_local_elements_begin(),
437 old_mesh.active_local_elements_end());
439 Integrate integrate(old_sys, *goal_function);
444 Number integral = integrate.integral();
445 old_mesh.comm().sum(integral);
446 libMesh::out <<
"Integral is " << integral << std::endl;
This class handles the computation of the L2 and/or H1 error for the Systems in the EquationSystems o...
T command_line_next(std::string name, T default_value)
Use GetPot's search()/next() functions to get following arguments from the command line...
std::set< libMesh::subdomain_id_type > & subdomains_list()
This is the EquationSystems class.
A Function generated (via FParser) by parsing a mathematical expression.
bool quiet
The DiffSolver should not print anything to libMesh::out unless quiet is set to false; default is tru...
static constexpr Real TOLERANCE
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
std::unique_ptr< TimeSolver > time_solver
A pointer to the solver object we're going to use.
This class defines a norm/seminorm to be applied to a NumericVector which contains coefficients in a ...
The StoredRange class defines a contiguous, divisible set of objects.
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
void init()
Initializes degrees of freedom on the current mesh.
DIE A HORRIBLE DEATH HERE typedef float ErrorVectorReal
This is a generic class that defines a solver to handle ImplicitSystem classes, including NonlinearIm...
void set_goal_func(libMesh::FEMFunctionBase< libMesh::Number > &goal)
void set_weight(unsigned int var, Real w)
Sets the weight corresponding to the norm in variable var, as well as for any unset variables with in...
T assert_argument(const std::string &argname, const char *progname, const T &defaultarg)
Manages consistently variables, degrees of freedom, and coefficient vectors.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
const std::string & variable_name(const unsigned int i) const
std::string & fe_family()
virtual void read(const std::string &filename)
Read the contents of the matrix from a file, with the file format inferred from the extension of file...
unsigned int & fe_order()
bool verbose
The DiffSolver may print a lot more to libMesh::out if verbose is set to true; default is false...
unsigned int & hilbert_order()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
libMesh::System * input_system
std::string current_sys_name
void command_line_vector(const std::string &, std::vector< T > &)
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
void parallel_reduce(const Range &range, Body &body)
Execute the provided reduction operation in parallel on the specified range.
virtual void solve() override
Invokes the solver associated with the system.
bool on_command_line(std::string arg)
void set_type(unsigned int var, const FEMNormType &t)
Sets the type of the norm in variable var, as well as for any unset variables with index less than va...
unsigned int n_vars() const
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false) override
Reads the file specified by name.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
void set_fdm_eps(libMesh::Real eps)
Real relative_step_tolerance