diff --git a/docs/changelog.rst b/docs/changelog.rst index 73ac1d7..71dc956 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,85 +1,96 @@ ********* Changelog ********* +v0.6.0 +====== + +* Adding ``Mesh::Quad4::FineLayer::elementgrid_around_ravel`` +* ``FineLayer::elementgrid_ravel``: Adding test +* Renaming ``elementMatrix`` -> ``elementgrid`` everywhere +* Adding ``Mesh::Quad4::FineLayer::elementgrid_ravel`` +* Adding ``GOOFEM_WIP_ASSERT`` to assert if code needs to be generalized +* API change: renaming ``Mesh::Quad4::Regular::elementMatrix`` + -> M``esh::Quad4::Regular::elementgrid``. + v0.5.1 ====== * FineLayer - replica: bug-fix in size detection. * Updated examples to new GMat API. v0.5.0 ====== * Renaming ``MatrixDiagonal::AsDiagonal`` -> ``MatrixDiagonal::Todiagonal`` to maintain API consistency. * Adding ``Mesh::elemmap2nodemap``. Updating Python API. * Adding ``roll`` to FineLayer. * Adding ``Mesh::centers`` and ``Mesh::defaultElementType``. * Mapping connectivity on generating FineLayer-object. * Switching to new GMat API. * Solver: force factorization on the first call. * Sorting output of ``GooseFEM::Mesh::elem2node``. Adding checks. * Switched to GitHub CI. * Adding ``todense`` to sparse matrix classes. * Adding ``dot`` to ``MatrixPartitioned``. v0.4.2 ====== * CMake: using Eigen's CMake target. v0.4.1 ====== API additions ------------- * Added "AllocateElemmat". v0.4.0 ====== API additions ------------- * Added "AllocateQtensor", "AllocateQscalar", "AllocateDofval", "AllocateNodevec", "AllocateElemvec". API changes ----------- * Removing Paraview interface: replaced by external libraries "XDMFWrite_HighFive" and "XDMFWrite_h5py". * Element*: "dV" now only returns raw data, the "asTensor" member function (and free function) can be used to convert the 'qscalar' to a 'qtensor'. * Separating sparse solver in separate class to offer more flexibility in the future. * Adding "dot" to "Matrix". Other updates ------------- * Applying clang-format to source, python API, tests, and examples.. * Adding test GMatElastoPlasticQPot. * Adding test based on hybrid material definitions. * Formatting update: renaming all return variables "out" to "ret". * Correction zero allocation to allows for dofval.size() > nodevec.size() * Formatting update xt::amax and xt::sum. * Renaming private function to begin with caps when the function allocates its return data. * Reducing copies when using Eigen. * Reducing default size examples. * Supporting Windows (#87). * Removing xtensor_fixed. * Using xt::has_shape. diff --git a/docs/details/MeshQuad4.rst b/docs/details/MeshQuad4.rst index 2d74509..7e4d3d6 100644 --- a/docs/details/MeshQuad4.rst +++ b/docs/details/MeshQuad4.rst @@ -1,292 +1,307 @@ .. _MeshQuad4: *********** Mesh::Quad4 *********** | :download:`GooseFEM/MeshQuad4.h <../../include/GooseFEM/MeshQuad4.h>` | :download:`GooseFEM/MeshQuad4.hpp <../../include/GooseFEM/MeshQuad4.hpp>` Naming convention ================= .. image:: figures/MeshQuad4/naming_convention.svg :width: 350px :align: center Mesh::Quad4::Regular ==================== Regular mesh. .. seealso:: | :download:`Python - example ` Mesh::Quad4::Regular::nelem() ----------------------------- Return number of elements. Mesh::Quad4::Regular::nnode() ----------------------------- Return number of nodes. Mesh::Quad4::Regular::nne() --------------------------- Return number of nodes-per-element (= 3). Mesh::Quad4::Regular::ndim() ---------------------------- Return number of dimensions (= 2). Mesh::Quad4::Regular::getElementType() -------------------------------------- Return element-type. Mesh::Quad4::Regular::coor() ---------------------------- Return nodal coordinates [nnode, ndim]. Mesh::Quad4::Regular::conn() ---------------------------- Return connectivity [nelem, nne]. Mesh::Quad4::Regular::nodesXXXEdge() ------------------------------------ Node numbers along the "Bottom", "Top", "Left", or "Right" edge. Mesh::Quad4::Regular::nodesXXXOpenEdge() ---------------------------------------- Node numbers along the "Bottom", "Top", "Left", or "Right" edge, excluding the corners. Mesh::Quad4::Regular::nodesXXXCorner() -------------------------------------- Node number of one of the corners (e.g. "BottomLeft"). Mesh::Quad4::Regular::nodesPeriodic() ------------------------------------- Periodic node pairs. Each row contains on pair of (independent, dependent) node numbers. The output shape is thus [n_pairs, 2]. Mesh::Quad4::Regular::nodesOrigin() ----------------------------------- Bottom-left node, used as reference for periodicity. Mesh::Quad4::Regular::dofs() ---------------------------- DOF-numbers for each component of each node (sequential). The output shape is thus [nnode, ndim]. Mesh::Quad4::Regular::dofsPeriodic() ------------------------------------ DOF-numbers for each component of each node, for the case that the periodicity if fully eliminated. The output shape is thus [nnode, ndim]. Mesh::Quad4::Regular::elementgrid() ----------------------------------- Return element numbers as matrix [nely, nelx]. Mesh::Quad4::FineLayer ====================== Mesh with a fine layer in the middle, and that becomes course away from this plane (see image below). Note coursening can only be done if the number of elements in horizontal direction is dividable by 3, and that it is only optimal if the number of elements in horizontal direction is a factor of 3. Note that the number of elements in the vertical direction is specified as the number of times the unit element (the number of times "h" the height should be), and that this number is only a target: the algorithm chooses in accordance with the applied coursing. .. image:: figures/MeshQuad4/FineLayer/behaviour.svg :width: 800px :align: center .. seealso:: | :download:`Python - example ` | :download:`Python - behaviour 'nx' ` | :download:`Python - element numbers ` Mesh::Quad4::FineLayer::nelem() ------------------------------- Return number of elements. Mesh::Quad4::FineLayer::nnode() ------------------------------- Return number of nodes. Mesh::Quad4::FineLayer::nne() ----------------------------- Return number of nodes-per-element (= 3). Mesh::Quad4::FineLayer::ndim() ------------------------------ Return number of dimensions (= 2). Mesh::Quad4::FineLayer::nelx() ------------------------------ Number of elements in horizontal direction (along the weak layer) (matches input). Mesh::Quad4::FineLayer::nely() ------------------------------ Actual number of elements unit elements in vertical direction (actual number of times "h" the mesh is heigh). Mesh::Quad4::FineLayer::h() --------------------------- Unit edge size (matches input). Mesh::Quad4::FineLayer::getElementType() ---------------------------------------- Return element-type. Mesh::Quad4::FineLayer::coor() ------------------------------ Return nodal coordinates [nnode, ndim]. Mesh::Quad4::FineLayer::conn() ------------------------------ Return connectivity [nelem, nne]. Mesh::Quad4::FineLayer::nodesXXXEdge() -------------------------------------- Node numbers along the "Bottom", "Top", "Left", or "Right" edge. Mesh::Quad4::FineLayer::nodesXXXOpenEdge() ------------------------------------------ Node numbers along the "Bottom", "Top", "Left", or "Right" edge, excluding the corners. Mesh::Quad4::FineLayer::nodesXXXCorner() ---------------------------------------- Node number of one of the corners (e.g. "BottomLeft"). Mesh::Quad4::FineLayer::nodesPeriodic() --------------------------------------- Periodic node pairs. Each row contains on pair of (independent, dependent) node numbers. The output shape is thus [n_pairs, 2]. Mesh::Quad4::FineLayer::nodesOrigin() ------------------------------------- Bottom-left node, used as reference for periodicity. Mesh::Quad4::FineLayer::dofs() ------------------------------ DOF-numbers for each component of each node (sequential). The output shape is thus [nnode, ndim]. Mesh::Quad4::FineLayer::dofsPeriodic() -------------------------------------- DOF-numbers for each component of each node, for the case that the periodicity if fully eliminated. The output shape is thus [nnode, ndim]. Mesh::Quad4::FineLayer::elementsMiddleLayer() --------------------------------------------- -Element numbers of the middle, fine, layer +Element numbers of the middle, fine, layer. + +Mesh::Quad4::FineLayer::elementgrid_ravel +----------------------------------------- + +Slice of an equivalent 'matrix' of elements. + +Mesh::Quad4::FineLayer::elementgrid_around_ravel +------------------------------------------------ + +Slice of an equivalent 'matrix' of elements, such that the slice contains an minimum width +around a selected element. + +.. image:: figures/MeshQuad4/FineLayer/elementgrid.svg + :width: 400px + :align: center Details ------- -.. image:: figures/MeshQuad4/FineLayer/element_numbers.svg +.. image:: figures/MeshQuad4/FineLayer/element-numbers.svg :width: 400px :align: center Mesh::Quad4::Map::RefineRegular =============================== Refine a "Regular" mesh. Mesh::Quad4::Map::RefineRegular::getCoarseMesh() ------------------------------------------------ Return course mesh as "Mesh::Quad4::Regular". Mesh::Quad4::Map::RefineRegular::getFineMesh() ---------------------------------------------- Return fine mesh as "Mesh::Quad4::Regular". Mesh::Quad4::Map::RefineRegular::getMap() ----------------------------------------- Elements of the fine mesh per element of the coarse mesh (rows). Mesh::Quad4::Map::RefineRegular::mapToCoarse(...) ------------------------------------------------- Map field to the course mesh: * Scalar per element. * Scalar per integration point. * Tensor per integration point. Mesh::Quad4::Map::RefineRegular::mapToFine(...) ----------------------------------------------- Map field to the fine mesh: * Scalar per element. * Scalar per integration point. * Tensor per integration point. Mesh::Quad4::Map::FineLayer2Regular =================================== Map "Regular" mesh to "FineLayer" mesh. .. image:: figures/MeshQuad4/Map/FineLayer2Regular/map.svg :width: 350px :align: center .. seealso:: | :download:`Python - map ` | :download:`Python - element numbers ` Mesh::Quad4::Map::FineLayer2Regular::getCoarseMesh() ---------------------------------------------------- Return course mesh as "Mesh::Quad4::Regular". Mesh::Quad4::Map::FineLayer2Regular::getFineMesh() -------------------------------------------------- Return fine mesh as "Mesh::Quad4::Regular". Mesh::Quad4::Map::FineLayer2Regular::getMap() --------------------------------------------- Elements of the fine mesh per element of the coarse mesh (rows). Mesh::Quad4::Map::FineLayer2Regular::getMapFraction() ----------------------------------------------------- Get the fraction of overlap for the output of "getMap()". Mesh::Quad4::Map::FineLayer2Regular::mapToRegular(...) ------------------------------------------------------ Map field to the course mesh: * Scalar per element. * Scalar per integration point. * Tensor per integration point. diff --git a/include/GooseFEM/config.h b/include/GooseFEM/config.h index f4a4da4..db050ca 100644 --- a/include/GooseFEM/config.h +++ b/include/GooseFEM/config.h @@ -1,85 +1,85 @@ /* (c - GPLv3) T.W.J. de Geus (Tom) | tom@geus.me | www.geus.me | github.com/tdegeus/GooseFEM */ #ifndef GOOSEFEM_CONFIG_H #define GOOSEFEM_CONFIG_H #define _USE_MATH_DEFINES // to use "M_PI" from "math.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace xt::placeholders; #define UNUSED(p) ((void)(p)) #ifdef GOOSEFEM_ENABLE_ASSERT #define GOOSEFEM_ASSERT(expr) GOOSEFEM_ASSERT_IMPL(expr, __FILE__, __LINE__) #define GOOSEFEM_ASSERT_IMPL(expr, file, line) \ if (!(expr)) { \ throw std::runtime_error( \ std::string(file) + ':' + std::to_string(line) + \ ": assertion failed (" #expr ") \n\t"); \ } #else #define GOOSEFEM_ASSERT(expr) #endif #define GOOSEFEM_CHECK(expr) GOOSEFEM_CHECK_IMPL(expr, __FILE__, __LINE__) #define GOOSEFEM_CHECK_IMPL(expr, file, line) \ if (!(expr)) { \ throw std::runtime_error( \ std::string(file) + ':' + std::to_string(line) + \ ": assertion failed (" #expr ") \n\t"); \ } #define GOOSEFEM_WIP_ASSERT(expr) GOOSEFEM_CHECK_IMPL(expr, __FILE__, __LINE__) #define GOOSEFEM_WIP_ASSERT_IMPL(expr, file, line) \ if (!(expr)) { \ throw std::runtime_error( \ std::string(file) + ':' + std::to_string(line) + \ ": WIP, please extend the code, assertion failed (" #expr ") \n\t"); \ } #define GOOSEFEM_VERSION_MAJOR 0 -#define GOOSEFEM_VERSION_MINOR 5 -#define GOOSEFEM_VERSION_PATCH 1 +#define GOOSEFEM_VERSION_MINOR 6 +#define GOOSEFEM_VERSION_PATCH 0 #define GOOSEFEM_VERSION_AT_LEAST(x, y, z) \ (GOOSEFEM_VERSION_MAJOR > x || (GOOSEFEM_VERSION_MAJOR >= x && \ (GOOSEFEM_VERSION_MINOR > y || (GOOSEFEM_VERSION_MINOR >= y && \ GOOSEFEM_VERSION_PATCH >= z)))) #define GOOSEFEM_VERSION(x, y, z) \ (GOOSEFEM_VERSION_MAJOR == x && \ GOOSEFEM_VERSION_MINOR == y && \ GOOSEFEM_VERSION_PATCH == z) #endif