17#include "strangsplitting.h"
22int main(
int ,
char ** ) {
24 auto mesh_factory = std::make_unique<lf::mesh::hybrid2d::MeshFactory>(2);
25 std::filesystem::path here = __FILE__;
26 auto mesh_file = (here.parent_path() /
"/meshes/Island.msh").
string();
28 std::shared_ptr<const lf::mesh::Mesh> mesh_p = reader.mesh();
30 std::shared_ptr<lf::uscalfe::UniformScalarFESpace<double>> fe_space =
31 std::make_shared<lf::uscalfe::FeSpaceLagrangeO1<double>>(mesh_p);
36 std::cout <<
"N_dofs :" << N_dofs << std::endl;
39 Eigen::VectorXd u0(N_dofs);
44 auto c = [](
const Eigen::Vector2d & ) ->
double {
return 1.2; };
60 auto boundary_nodes = [&bd_flags, &dofh](
unsigned int idx) ->
bool {
61 return bd_flags(dofh.Entity(idx));
67 return bd_flags_edge(edge);
73 auto h = [fe_space, mesh_p, edge_pred](
const Eigen::Vector2d &x) ->
double {
76 auto g = [&x](
const Eigen::Vector2d &y) ->
double {
93 Eigen::MatrixXd L(N_dofs, N_dofs);
94 for (
int j = 0; j < N_dofs; j++) {
95 if (boundary_nodes(j)) {
96 auto L_j = [fe_space, &dofh, N_dofs, edge_pred,
97 j](
const Eigen::Vector2d &x) ->
double {
98 auto g_j = [&x](
const Eigen::Vector2d &y) ->
double {
104 Eigen::VectorXd L1(N_dofs);
110 edgeVec_y(fe_space, mf_g, edge_pred);
116 Eigen::VectorXd L2(N_dofs);
122 edgeVec_x(fe_space, mf_L, edge_pred);
129 L.col(j) = Eigen::VectorXd::Zero(N_dofs);
139 unsigned int m = 120;
143 StrangSplit StrangSplitter(fe_space, T, m, lambda, c, h, L);
145 Eigen::MatrixXd sol(N_dofs, 12);
146 Eigen::VectorXd cap(N_dofs);
148 cap = 0.9 * Eigen::VectorXd::Ones(N_dofs);
150 sol.col(0) = StrangSplitter.Evolution(cap, u0);
151 for (
int i = 1; i < 6; i++) {
152 sol.col(i) = StrangSplitter.Evolution(cap, sol.col(i - 1));
156 for (
int k = 1; k < 7; k++) {
157 std::stringstream filename;
158 filename <<
"sol" << k <<
".vtk";
161 auto nodal_data = lf::mesh::utils::make_CodimMeshDataSet<double>(mesh_p, 2);
162 for (
int global_idx = 0; global_idx < N_dofs; global_idx++) {
163 nodal_data->operator()(dofh.Entity(global_idx)) =
164 sol.col(k - 1)[global_idx];
167 vtk_writer.WritePointData(
"sol", *nodal_data);
A general (interface) class for DOF handling, see Lecture Document Paragraph 2.7.4....
static constexpr RefEl kSegment()
Returns the (1-dimensional) reference segment.
static constexpr RefEl kTria()
Returns the reference triangle.
Reads a Gmsh *.msh file into a mesh::MeshFactory and provides a link between mesh::Entity objects and...
Write a mesh along with mesh data into a vtk file.
Interface class representing a topological entity in a cellular complex
MeshFunction wrapper for a simple function of physical coordinates.
auto squaredNorm(const A &a)
Pointwise squared norm of another mesh function.
Local edge contributions to element vector.
void AssembleVectorLocally(dim_t codim, const DofHandler &dof_handler, ENTITY_VECTOR_PROVIDER &entity_vector_provider, VECTOR &resultvector)
entity-local assembly of (right-hand-side) vectors from element vectors
QuadRule make_TriaQR_EdgeMidpointRule()
edge midpoint quadrature rule for reference triangles
auto localQuadFunction(const lf::mesh::Mesh &mesh, std::map< lf::base::RefEl, lf::quad::QuadRule > quadrules, FUNCTOR &&f, unsigned int codim, const std::function< bool(const lf::mesh::Entity &)> &pred)
CodimMeshDataSet< bool > flagEntitiesOnBoundary(const std::shared_ptr< const Mesh > &mesh_p, lf::base::dim_t codim)
flag entities of a specific co-dimension located on the boundary
QuadRule make_QuadRule(base::RefEl ref_el, unsigned degree)
Returns a QuadRule object for the given Reference Element and Degree.
lf::assemble::size_type size_type