Skip to content

Commit

Permalink
Cosserat (#82)
Browse files Browse the repository at this point in the history
* first commit

* move a file to a dedicated repo

* add lumped mass for vec bdm1and new vec rt0 class

* add lumped mass for pw linears

* add optional data in the computation of the l2 errors

* in the rt0 mass matrix do the dummy data if data are not given

* added spanning tree

* fix flake8 complain

* fix a - in the asym 2d

* add specific computation of the L2 error for vecP0

* update l2 error computation

* fix some orthographic mistakes

* update the dummy data creation in the rt0

* update the unit data in the mdg

* in the projection use unit instead of flow as standard keyword

* update the test elasticity with the new definition of the asym operator in 2d

* remove comment from test projection

* add for the text vecbdm1 the check for the lump mass matrix and projection to and from rt0

* update the test vector pw constant in the computation of the error

* add test for vec rt0

* add tutorial for the elasticity mixed

* add tutorial for cosserat

* update create grid to pass kwargs correctly to pp

* update requirements dev to be compliant with pp

* update file according to the new version of black

* fix some spelling mistake

* changed asym to pwLinears
implemented VecPWLinears
implemented eval_at_centers for PwLinears

* implemented cosserat asymasym term

* add small details in the comments

* introduced cosserat matrix VecRT0
introduced lumped cosserat matrix VecBDM1
included tests
added weight to PwLinear mass
included test for pwlinear eval

* add test for the vector pw linear space

* add test for spanning tree Cosserat

* remove slash from \G and \d

* update the tutorial for cosserat

* use the mass_cosserat in the tutorial

* update cosserat tutorial

* change from pop to get in kwargs in the create_grid file

---------

Co-authored-by: Wietse Boon <[email protected]>
  • Loading branch information
alessiofumagalli and wmboon authored Oct 8, 2024
1 parent cac6b67 commit 2713e57
Show file tree
Hide file tree
Showing 23 changed files with 1,829 additions and 93 deletions.
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
black == 23.*
black == 24.*
deepdiff
flake8
isort
mypy >= 0.981
mypy
pytest >= 4.6
pytest-cov
pytest-runner
10 changes: 8 additions & 2 deletions src/pygeon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
from pygeon.discretizations.vec_discretization import VecDiscretization

from pygeon.discretizations.fem.hcurl import Nedelec0, Nedelec1
from pygeon.discretizations.fem.hdiv import RT0, BDM1, VecBDM1
from pygeon.discretizations.fem.hdiv import RT0, BDM1, VecBDM1, VecRT0
from pygeon.discretizations.fem.h1 import Lagrange1, VecLagrange1
from pygeon.discretizations.fem.l2 import PwConstants, PwLinears, VecPwConstants
from pygeon.discretizations.fem.l2 import (
PwConstants,
PwLinears,
VecPwConstants,
VecPwLinears,
)

from pygeon.discretizations.vem.hdiv import VRT0, VBDM1
from pygeon.discretizations.vem.h1 import VLagrange1, VecVLagrange1
Expand All @@ -44,6 +49,7 @@
SpanningTree,
SpanningWeightedTrees,
SpanningTreeElasticity,
SpanningTreeCosserat,
)

import pygeon.utils.bmat as bmat
Expand Down
3 changes: 2 additions & 1 deletion src/pygeon/discretizations/discretization.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ def error_l2(
ana_sol: Callable[[np.ndarray], np.ndarray],
relative: Optional[bool] = True,
etype: Optional[str] = "standard",
data: dict = None,
) -> float:
"""
Returns the l2 error computed against an analytical solution given as a function.
Expand All @@ -281,7 +282,7 @@ def error_l2(
float: The computed error.
"""
int_sol = self.interpolate(sd, ana_sol)
mass = self.assemble_mass_matrix(sd)
mass = self.assemble_mass_matrix(sd, data)

norm = (int_sol @ mass @ int_sol.T) if relative else 1

Expand Down
Loading

0 comments on commit 2713e57

Please sign in to comment.