diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e44f87b167523010cea1145a8f8f7614ae4429a4..058e9be40bdbaa268c4f41c87461b71f3b4857d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,6 +34,7 @@ build:all: # NOTE: Only upload required apps to reduce artifacts size paths: - build-cmake/apps/structured2d_p2 + - build-cmake/apps/cell2d_p2 expire_in: 6h # Build tests diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 49e896e3cf09c0aac406ac50d42a25da001900e5..a3594a5e0cc10097cb448a5425af4f65a2c804c9 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -1,6 +1,7 @@ set(APPS structured2d_p2 structured3d_p1 + cell2d_p2 cell3d_p1 cell3d_p2 ) @@ -16,5 +17,11 @@ endforeach() foreach(num 23_1 23_2 23_3 24_1 24_2) add_test(NAME run_hansbo_${num} COMMAND structured2d_p2 run ${PROJECT_SOURCE_DIR}/experiments/hansbo_reproduction/fig${num}.yml -) + ) +endforeach() + +foreach(case beam strech truss) + add_test(NAME run_hansbo_mixeddim_${case} + COMMAND cell2d_p2 run ${PROJECT_SOURCE_DIR}/experiments/mixeddim_validation/hansbo_${case}.yml + ) endforeach() diff --git a/apps/cell2d_p2.cc b/apps/cell2d_p2.cc new file mode 100644 index 0000000000000000000000000000000000000000..31b7615629b6719e7909aa024dc6cb55f7ec0b23 --- /dev/null +++ b/apps/cell2d_p2.cc @@ -0,0 +1,82 @@ +#include "config.h" + +/** This is the main app that allows to access all of BlockLab's core + * capabilities through one executable. Of course, it takes horribly + * long to compile. For downstream projects, it makes much more sense + * to provide their own app, that follows the implementation patterns + * used in this app, but only includes the necessary grid provider, + * vector providers and blocks. + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include + +int +main(int argc, char** argv) +{ + auto init = Dune::BlockLab::initBlockLab(argc, argv); + + using GridProvider = StructuresGridProvider<2>; + auto grid = [](const auto& c) { return std::make_shared(c); }; + + auto vectors = std::make_tuple( + std::make_tuple( + "Displacement Field", + "P2 Lagrange Element", + [](auto gp) { + using GridProvider = typename decltype(gp)::element_type; + auto leaf = std::make_shared< + Dune::BlockLab::PkFemVectorProvider>(gp); + return Dune::BlockLab::fieldProvider( + leaf); + }), + std::make_tuple( + "Body Force", + "P2 Lagrange Element", + [](auto gp) { + using GridProvider = typename decltype(gp)::element_type; + auto leaf = std::make_shared< + Dune::BlockLab::PkFemVectorProvider>(gp); + return Dune::BlockLab::fieldProvider( + leaf); + }), + std::make_tuple("Traction Force", "P2 Lagrange Element", [](auto gp) { + using GridProvider = typename decltype(gp)::element_type; + auto leaf = + std::make_shared>( + gp); + return Dune::BlockLab::fieldProvider(leaf); + })); + + using Material = std::shared_ptr< + ElasticMaterialBase, + double>>; + using ParameterTuple = + std::tuple>, Material>; + + Dune::BlockLab::BlockLabApp app( + init, grid, vectors, registerStructuresBlocks, ParameterTuple{}); + + app.addDefaultRunner(); + app.addFrontendExporter(); + app.addHelpMessage(); + app.setTitle("2D Biological Cell Grid - Quadratic Elements"); + + app.run(); + + return 0; +} diff --git a/experiments/mixeddim_validation/hansbo_beam.ini b/experiments/mixeddim_validation/hansbo_beam.ini deleted file mode 100644 index bb7734f31a4fef997381c7bc3d5972d90332b2f8..0000000000000000000000000000000000000000 --- a/experiments/mixeddim_validation/hansbo_beam.ini +++ /dev/null @@ -1,68 +0,0 @@ -[solver] -steps = material, interpolation, constraints, elasticity_operator, linearsolver, visualization, probe -degree = 2 - -[grid] -dimension = 2 -type = cell -filename = hansbo_beam - -[grid.cytoplasm] -meshwidth = 0.1 -physical = 0 -shape = box -lowerleft = 0.0 0.0 -size = 4.0 1.0 - -[grid.fibres] -fibres = first - -[grid.fibres.first] -shape = cylinder -meshwidth = 0.025 -start = -0.5 0.501 -end = 4.5 0.501 -radius = 0.05 -physical = 1 - -[grid.export.vtk] -filename = debug -enabled = 1 - -[material] -materials = bulk, fib - -[material.bulk] -model = linear -youngs_modulus = 300 -poisson_ratio = 0.3333 -group = 0 - -[material.fib] -model = linear -youngs_modulus = 1e6 -poisson_ratio = 0.3333 -group = 1 - -[interpolation] -functions = 0.0 - -[constraints] -functions = x < 1e-8 - -[elasticity_operator] -force = 0, -1 - -[linearsolver] -operator = elasticity_operator - -[visualization] -steps = vis_solution, vis_vonmises, vis_physicalentity -name = hansbo_beam - -[vis_vonmises] -continuous = 1 - -[probe] -position = 4.0 1.0 - diff --git a/experiments/mixeddim_validation/hansbo_beam.yml b/experiments/mixeddim_validation/hansbo_beam.yml new file mode 100644 index 0000000000000000000000000000000000000000..9b6a3e0872eb98fa28013ee8797c7d90e19dd359 --- /dev/null +++ b/experiments/mixeddim_validation/hansbo_beam.yml @@ -0,0 +1,66 @@ +solver: + vectors: + - Displacement Field_0 + - Body Force_0 + - Traction Force_0 + grid: + _blockname: grid_0 + cytoplasm: + meshwidth: 0.1 + group: 0 + shape: box + lowerleft: [0.0, 0.0] + size: [4.0, 1.0] + fibres: + - shape: cylinder + meshwidth: 0.025 + start: [-0.5, 0.501] + end: [4.5, 0.501] + radius: 0.05 + group: 1 + blocks: + - _type: material + _blockname: material_0 + materials: + - group: 0 + model: linear + poisson_ratio: 0.3333 + youngs_modulus: 300 + - group: 1 + model: linear + poisson_ratio: 0.3333 + youngs_modulus: 1e6 + - _type: interpolation + _blockname: interpolation_0 + functions: 0 + vector: 0 + - _type: interpolation + _blockname: interpolation_1 + functions: 0, -1 + vector: 1 + - _type: constraints + _blockname: constraints_0 + functions: x < 1e-8 + vector: 0 + - _type: linearsolver + _blockname: linearsolver_0 + operator: + elasticity: + _blockname: elasticity_0 + vector: 0 + - _type: visualization + _blockname: visualization_0 + blocks: + - _type: vis_vector + _blockname: vis_vector_0 + vector: 0 + - _type: vis_vonmises + _blockname: vis_vonmises_0 + continuous: true + vector: 0 + - _type: vis_physical + _blockname: vis_physical_0 + filename: hansbo_beam + instationary: false + intervals: 1 + path: vtk diff --git a/experiments/mixeddim_validation/hansbo_strech.yml b/experiments/mixeddim_validation/hansbo_strech.yml new file mode 100644 index 0000000000000000000000000000000000000000..c8b4579cad24a3f143744378de8791468e9bff00 --- /dev/null +++ b/experiments/mixeddim_validation/hansbo_strech.yml @@ -0,0 +1,72 @@ +solver: + vectors: + - Displacement Field_0 + - Body Force_0 + - Traction Force_0 + grid: + _blockname: grid_0 + cytoplasm: + meshwidth: 0.1 + group: 0 + shape: box + lowerleft: [0.0, 0.0] + size: [4.0, 1.0] + fibres: + - shape: cylinder + meshwidth: 0.025 + start: [-0.5, 0.249] + end: [4.5, 0.249] + radius: 0.05 + group: 1 + - shape: cylinder + meshwidth: 0.025 + start: [-0.5, 0.751] + end: [4.5, 0.751] + radius: 0.05 + group: 1 + blocks: + - _type: material + _blockname: material_0 + materials: + - group: 0 + model: linear + poisson_ratio: 0.3333 + youngs_modulus: 300 + - group: 1 + model: linear + poisson_ratio: 0.3333 + youngs_modulus: 1e4 + - _type: interpolation + _blockname: interpolation_0 + functions: 0 + vector: 0 + - _type: interpolation + _blockname: interpolation_1 + functions: 100, 0 + vector: 1 + - _type: constraints + _blockname: constraints_0 + functions: x < 1e-8 + vector: 0 + - _type: linearsolver + _blockname: linearsolver_0 + operator: + elasticity: + _blockname: elasticity_0 + vector: 0 + - _type: visualization + _blockname: visualization_0 + blocks: + - _type: vis_vector + _blockname: vis_vector_0 + vector: 0 + - _type: vis_vonmises + _blockname: vis_vonmises_0 + continuous: true + vector: 0 + - _type: vis_physical + _blockname: vis_physical_0 + filename: hansbo_stretch + instationary: false + intervals: 1 + path: vtk diff --git a/experiments/mixeddim_validation/hansbo_stretch.ini b/experiments/mixeddim_validation/hansbo_stretch.ini deleted file mode 100644 index e5ba9a036e324e51f97e1c8d2bd2c04a77f37eaa..0000000000000000000000000000000000000000 --- a/experiments/mixeddim_validation/hansbo_stretch.ini +++ /dev/null @@ -1,76 +0,0 @@ -[solver] -steps = material, interpolation, constraints, elasticity_operator, linearsolver, visualization, probe -degree = 2 - -[grid] -dimension = 2 -type = cell -filename = hansbo_stretch - -[grid.cytoplasm] -meshwidth = 0.1 -physical = 0 -shape = box -lowerleft = 0.0 0.0 -size = 4.0 1.0 - -[grid.fibres] -fibres = first, second - -[grid.fibres.first] -shape = cylinder -meshwidth = 0.025 -start = -0.5 0.249 -end = 4.5 0.249 -radius = 0.05 -physical = 1 - -[grid.fibres.second] -shape = cylinder -meshwidth = 0.025 -start = -0.5 0.751 -end = 4.5 0.751 -radius = 0.05 -physical = 1 - -[grid.export.vtk] -filename = debug -enabled = 1 - -[material] -materials = bulk, fib - -[material.bulk] -model = linear -youngs_modulus = 300 -poisson_ratio = 0.3333 -group = 0 - -[material.fib] -model = linear -youngs_modulus = 1e4 -poisson_ratio = 0.3333 -group = 1 - -[interpolation] -functions = 0.0 - -[constraints] -functions = x < 1e-8 - -[elasticity_operator] -force = 100, 0 - -[linearsolver] -operator = elasticity_operator - -[visualization] -steps = vis_solution, vis_vonmises, vis_physicalentity -name = hansbo_stretch - -[vis_vonmises] -continuous = 1 - -[probe] -position = 4.0 1.0 - diff --git a/experiments/mixeddim_validation/hansbo_truss.ini b/experiments/mixeddim_validation/hansbo_truss.ini deleted file mode 100644 index 26836127f2e8f765676b237abdcb0b496c73a3e6..0000000000000000000000000000000000000000 --- a/experiments/mixeddim_validation/hansbo_truss.ini +++ /dev/null @@ -1,75 +0,0 @@ -[solver] -steps = material, interpolation, constraints, elasticity_operator, linearsolver, visualization, probe -degree = 2 - -[grid] -dimension = 2 -type = cell -filename = hansbo_truss - -[grid.cytoplasm] -meshwidth = 0.1 -physical = 0 -shape = box -lowerleft = 0.0 0.0 -size = 4.0 1.0 - -[grid.fibres] -fibres = first, second - -[grid.fibres.first] -shape = cylinder -meshwidth = 0.025 -start = -0.5 0.249 -end = 4.5 0.249 -radius = 0.05 -physical = 1 - -[grid.fibres.second] -shape = cylinder -meshwidth = 0.025 -start = -0.5 0.751 -end = 4.5 0.751 -radius = 0.05 -physical = 1 - -[grid.export.vtk] -filename = debug -enabled = 1 - -[material] -materials = bulk, fib - -[material.bulk] -model = linear -youngs_modulus = 300 -poisson_ratio = 0.3333 -group = 0 - -[material.fib] -model = linear -youngs_modulus = 1e4 -poisson_ratio = 0.3333 -group = 1 - -[interpolation] -functions = 0.0 - -[constraints] -functions = x < 1e-8 - -[elasticity_operator] -force = 0, -1 - -[linearsolver] -operator = elasticity_operator - -[visualization] -steps = vis_solution, vis_vonmises, vis_physicalentity -name = hansbo_truss - -[vis_vonmises] -continuous = 1 - -[probe] -position = 4.0 1.0 diff --git a/experiments/mixeddim_validation/hansbo_truss.yml b/experiments/mixeddim_validation/hansbo_truss.yml new file mode 100644 index 0000000000000000000000000000000000000000..9a253dfd30eae7c09f6fb10f1e8cb5f4a5d7801f --- /dev/null +++ b/experiments/mixeddim_validation/hansbo_truss.yml @@ -0,0 +1,72 @@ +solver: + vectors: + - Displacement Field_0 + - Body Force_0 + - Traction Force_0 + grid: + _blockname: grid_0 + cytoplasm: + meshwidth: 0.1 + group: 0 + shape: box + lowerleft: [0.0, 0.0] + size: [4.0, 1.0] + fibres: + - shape: cylinder + meshwidth: 0.025 + start: [-0.5, 0.249] + end: [4.5, 0.249] + radius: 0.05 + group: 1 + - shape: cylinder + meshwidth: 0.025 + start: [-0.5, 0.751] + end: [4.5, 0.751] + radius: 0.05 + group: 1 + blocks: + - _type: material + _blockname: material_0 + materials: + - group: 0 + model: linear + poisson_ratio: 0.3333 + youngs_modulus: 300 + - group: 1 + model: linear + poisson_ratio: 0.3333 + youngs_modulus: 1e4 + - _type: interpolation + _blockname: interpolation_0 + functions: 0 + vector: 0 + - _type: interpolation + _blockname: interpolation_1 + functions: 0, -1 + vector: 1 + - _type: constraints + _blockname: constraints_0 + functions: x < 1e-8 + vector: 0 + - _type: linearsolver + _blockname: linearsolver_0 + operator: + elasticity: + _blockname: elasticity_0 + vector: 0 + - _type: visualization + _blockname: visualization_0 + blocks: + - _type: vis_vector + _blockname: vis_vector_0 + vector: 0 + - _type: vis_vonmises + _blockname: vis_vonmises_0 + continuous: true + vector: 0 + - _type: vis_physical + _blockname: vis_physical_0 + filename: hansbo_truss + instationary: false + intervals: 1 + path: vtk