Skip to contents

(...)

Usage

fm_fem(mesh, order = 2, ...)

# S3 method for class 'fm_mesh_1d'
fm_fem(mesh, order = 2, ...)

# S3 method for class 'fm_mesh_2d'
fm_fem(mesh, order = 2, aniso = NULL, ...)

# S3 method for class 'fm_tensor'
fm_fem(mesh, order = 2, ...)

Arguments

mesh

fm_mesh_1d or other supported mesh class object

order

integer

...

Currently unused

aniso

If non-NULL, a list(gamma, v). Calculates anisotropic structure matrices (in addition to the regular) for \(\gamma\) and \(v\) for an anisotropic operator \(\nabla\cdot H \nabla\), where \(H=\gamma I + v v^\top\). Currently (2023-08-05) the fields need to be given per vertex.

Value

fm_fem.fm_mesh_1d: A list with elements c0, c1, g1, g2. When mesh$degree == 2, also g01, g02, and g12.

fm_fem.fm_mesh_2d: A list with elements c0, c1, g1, va, ta, and more if order > 1. When aniso is non-NULL, also g1aniso matrices, etc.

fm_fem.fm_tensor: A list with elements cc, g1, g2.

Examples

str(fm_fem(fmexample$mesh))
#> List of 9
#>  $ b1:Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
#>   .. ..@ i       : int [1:137] 0 0 0 0 1 1 1 1 1 2 ...
#>   .. ..@ j       : int [1:137] 0 1 25 257 0 1 2 226 257 1 ...
#>   .. ..@ Dim     : int [1:2] 279 279
#>   .. ..@ Dimnames:List of 2
#>   .. .. ..$ : NULL
#>   .. .. ..$ : NULL
#>   .. ..@ x       : num [1:137] 1.4155 0.1341 0.0209 -1.5705 0.4222 ...
#>   .. ..@ factors : list()
#>  $ c0:Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
#>   .. ..@ i       : int [1:279] 0 1 2 3 4 5 6 7 8 9 ...
#>   .. ..@ j       : int [1:279] 0 1 2 3 4 5 6 7 8 9 ...
#>   .. ..@ Dim     : int [1:2] 279 279
#>   .. ..@ Dimnames:List of 2
#>   .. .. ..$ : NULL
#>   .. .. ..$ : NULL
#>   .. ..@ x       : num [1:279] 0.343 0.542 0.427 0.564 0.439 ...
#>   .. ..@ factors : list()
#>  $ c1:Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
#>   .. ..@ i       : int [1:1889] 0 0 0 0 1 1 1 1 1 2 ...
#>   .. ..@ j       : int [1:1889] 0 1 25 257 0 1 2 226 257 1 ...
#>   .. ..@ Dim     : int [1:2] 279 279
#>   .. ..@ Dimnames:List of 2
#>   .. .. ..$ : NULL
#>   .. .. ..$ : NULL
#>   .. ..@ x       : num [1:1889] 0.1713 0.029 0.0566 0.0856 0.029 ...
#>   .. ..@ factors : list()
#>  $ g1:Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
#>   .. ..@ i       : int [1:1889] 0 0 0 0 1 1 1 1 1 2 ...
#>   .. ..@ j       : int [1:1889] 0 1 25 257 0 1 2 226 257 1 ...
#>   .. ..@ Dim     : int [1:2] 279 279
#>   .. ..@ Dimnames:List of 2
#>   .. .. ..$ : NULL
#>   .. .. ..$ : NULL
#>   .. ..@ x       : num [1:1889] 1.989 -0.348 -0.226 -1.415 -0.348 ...
#>   .. ..@ factors : list()
#>  $ g2:Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
#>   .. ..@ i       : int [1:5195] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. ..@ j       : int [1:5195] 0 1 2 24 25 225 226 229 233 245 ...
#>   .. ..@ Dim     : int [1:2] 279 279
#>   .. ..@ Dimnames:List of 2
#>   .. .. ..$ : NULL
#>   .. .. ..$ : NULL
#>   .. ..@ x       : num [1:5195] 13.8435 -2.1903 0.4929 0.0507 -1.4847 ...
#>   .. ..@ factors : list()
#>  $ k1:Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
#>   .. ..@ i       : int [1:1889] 0 0 0 0 1 1 1 1 1 2 ...
#>   .. ..@ j       : int [1:1889] 0 1 25 257 0 1 2 226 257 1 ...
#>   .. ..@ Dim     : int [1:2] 279 279
#>   .. ..@ Dimnames:List of 2
#>   .. .. ..$ : NULL
#>   .. .. ..$ : NULL
#>   .. ..@ x       : num [1:1889] 0.574 -0.482 -0.247 0.155 -0.77 ...
#>   .. ..@ factors : list()
#>  $ k2:Formal class 'dgTMatrix' [package "Matrix"] with 6 slots
#>   .. ..@ i       : int [1:5195] 0 0 0 0 0 0 0 0 0 0 ...
#>   .. ..@ j       : int [1:5195] 0 1 2 24 25 225 226 229 233 245 ...
#>   .. ..@ Dim     : int [1:2] 279 279
#>   .. ..@ Dimnames:List of 2
#>   .. .. ..$ : NULL
#>   .. .. ..$ : NULL
#>   .. ..@ x       : num [1:5195] 1.634 -2.457 0.925 0.146 -0.72 ...
#>   .. ..@ factors : list()
#>  $ ta: num [1:527, 1] 0.0641 0.0799 0.0794 0.0734 0.0383 ...
#>  $ va: num [1:279, 1] 0.343 0.542 0.427 0.564 0.439 ...