From 29611dde036362e869b4c27ea36777172172cd87 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Mon, 10 Jul 2023 13:10:49 +0000 Subject: [PATCH] build based on 18f7ebd --- dev/assemble/index.html | 2 +- dev/assets/postproc/index.html | 2 +- dev/index.html | 4 ++-- dev/quadstrat/index.html | 2 +- dev/search/index.html | 2 +- dev/tdefie/index.html | 2 +- dev/tutorial/index.html | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dev/assemble/index.html b/dev/assemble/index.html index e29fddb5..69bce62d 100644 --- a/dev/assemble/index.html +++ b/dev/assemble/index.html @@ -58,4 +58,4 @@ ) end -integrand(op::SingleLayerTrace, kernel, g, τ, f, σ) = f[1]*g[1]*kernel.green

Every kernel corresponds with a type. Kernels can potentially depend on a set of parameters; these appear as fields in the type. Here our Nitsche kernel depends on the wavenumber. In quaddata we precompute quadrature points for all geometric cells in the supports of test and trial elements. This is fairly sloppy: only one rule for test and trial integration is considered. A high accuracy implementation would typically compute points for both low quality and high quality quadrature rules.

Also quadrule is sloppy: we always select a DoubleQuadRule to perform the computation of interactions between local shape functions. No singularity extraction or other advanced technique is considered for nearby interactions. Clearly amateurs at work here!

BEAST provides a default implementation of an integration routine using double numerical quadrature. All that is required to tap into that implementation is a method overloading integrand. From the above formula it is clear what this method should look like.

That's it!

+integrand(op::SingleLayerTrace, kernel, g, τ, f, σ) = f[1]*g[1]*kernel.green

Every kernel corresponds with a type. Kernels can potentially depend on a set of parameters; these appear as fields in the type. Here our Nitsche kernel depends on the wavenumber. In quaddata we precompute quadrature points for all geometric cells in the supports of test and trial elements. This is fairly sloppy: only one rule for test and trial integration is considered. A high accuracy implementation would typically compute points for both low quality and high quality quadrature rules.

Also quadrule is sloppy: we always select a DoubleQuadRule to perform the computation of interactions between local shape functions. No singularity extraction or other advanced technique is considered for nearby interactions. Clearly amateurs at work here!

BEAST provides a default implementation of an integration routine using double numerical quadrature. All that is required to tap into that implementation is a method overloading integrand. From the above formula it is clear what this method should look like.

That's it!

diff --git a/dev/assets/postproc/index.html b/dev/assets/postproc/index.html index f3f2a7ca..e91e1c33 100644 --- a/dev/assets/postproc/index.html +++ b/dev/assets/postproc/index.html @@ -1,4 +1,4 @@ Post-processing and Visualisation · BEAST Documentation

Post-processing and Visualisation

Field computation

The main API for the computation of fields in a vector of points is the potential function. This function is capable of computing

\[F(x) = \int_{\Gamma} K(x,y) u(y) dy\]

with $u(y) = \Sigma_{i=1}^N u_i f_i(y)$ and $K(x,y)$ the integation kernel defining the type of potential. For example, the far field for a vector valued surface density is

\[F(x) = \int_{\Gamma} e^{ik \frac{x \cdot y}{|x|}} u(y) dy\]

For a far field potential such as this, the value only depends on the direction, not the magnitude, of $x$, as can be read off from the normalisation in the exponent.

The following script computes the far field along a semi-circle in the xz-plane.

Θ, Φ = range(0.0,stop=2π,length=100), 0.0
 dirs = [point(cos(ϕ)*sin(θ), sin(ϕ)*sin(θ), cos(θ)) for θ in Θ for ϕ in Φ]
-farfield = potential(MWFarField3D(wavenumber=κ), dirs, u, X)
+farfield = potential(MWFarField3D(wavenumber=κ), dirs, u, X) diff --git a/dev/index.html b/dev/index.html index 57375c30..0976f7ca 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,3 +1,3 @@ -BEAST.jl documentation · BEAST Documentation

BEAST.jl documentation

BEAST provides a number of types modelling concepts and a number of algorithms for the efficient and simple implementation of boundary and finite element solvers. It provides full implementations of these concepts for the LU based solution of boundary integral equations for the Maxwell and Helmholtz systems.

Because Julia only compiles code at execution time, users of this library can hook into the code provided in this package at any level. In the extreme case it suffices to provide overwrites of the assemble functions. In that case, only the LU solution will be performed by the code here.

At the other end it suffices that users only supply integration kernels that act on the element-element interaction level. This package will manage all required steps for matrix assembly.

For the Helmholtz 2D and Maxwell 3D systems, complete implementations are supplied. These models will be discussed in detail to give a more concrete idea of the APIs provides and how to extend them.

Central to the solution of boundary integral equations is the assembly of the system matrix. The system matrix is fully determined by specifying a kernel G, a set of trial functions, and a set of test functions.

Basis

Sets of both trial and testing functions are implemented by models following the basis concept. The term basis is somewhat misleading as it is nowhere required nor enforced that these functions are linearly independent. Models implementing the Basis concept need to comply to the following semantics.

  • numfunctions(basis): number of functions in the Basis.
  • coordtype(basis): type of (the components of) the values taken on by the functions in the Basis.
  • scalartype(d): the scalar field underlying the vector space the basis functions take value in.
  • refspace(basis): returns the ReferenceSpace of local shape functions on which the Basis is built.
  • assemblydata(basis): assemblydata returns an iterable collection elements of geometric elements and a look table ad for use in assembly of interaction matrices. In particular, for an index element_idx into elements and an index local_shape_idx in basis of local shape functions refspace(basis), ad[element_idx, local_shape_idx] returns the iterable collection of (global_idx, weight) tuples such that the local shape function at local_shape_idx defined on the element at element_idx contributes to the basis function at global_idx with a weight of weight.
  • geometry(basis): returns an iterable collection of Elements. The order in which these Elements are encountered corresponds to the indices used in the assembly data structure.

Reference Space

The reference space concept defines an API for working with spaces of local shape functions. The main role of objects implementing this concept is to allow specialization of the functions that depend on the precise reference space used.

The functions that depend on the type and value of arguments modeling reference space are:

Kernel

A kernel is a fairly simple concept that mainly exists as part of the definition of a Discrete Operator. A kernel should obey the following semantics:

In many function definitions the kernel object is referenced by operator or something similar. This is a misleading name as an operator definition should always be accompanied by the domain and range space.

Discrete Operator

Informally speaking, a Discrete Operator is a concept that allows for the computation of an interaction matrix. It is a kernel together with a test and trial basis. A Discrete Operator can be passed to assemble and friends to compute its matrix representation.

A discrete operator is a triple (kernel, test_basis, trial_basis), where kernel is a Kernel, and test_basis and trial_basis are Bases. In addition, the following expressions should be implemented and behave according to the correct semantics:

In the context of fast methods such as the Fast Multipole Method other algorithms on Discrete Operators will typically be defined to compute matrix vector products. These algorithms do not explicitly compute and store the interaction matrix (this would lead to unacceptable computational and memory complexity).

BEAST.elementsFunction

elements(geo)

Create an iterable collection of the elements stored in geo. The order in which this collection produces the elements determines the index used for lookup in the data structures returned by assemblydata and quaddata.

source
CompScienceMeshes.coordtypeFunction
coordtype(mesh)

Returns eltype(vertextype(mesh))

coordtype(simplex)

Return coordinate type used by simplex.

BEAST.scalartypeFunction
scalartype(x)

The scalar field over which the values of a global or local basis function, or an operator are defined. This should always be a scalar type, even if the basis or operator takes on values in a vector or tensor space. This data type is used to determine the eltype of assembled discrete operators.

source
BEAST.assemblydataFunction
charts, admap = assemblydata(basis)

Given a Basis this function returns a data structure containing the information required for matrix assemble. More precise the following expressions are valid for the returned object ad:

ad[c,r,i].globalindex
-ad[c,r,i].coefficient

Here, c and r are indices in the iterable set of geometric elements and the set of local shape functions on each element. i ranges from 1 to the maximum number of basis functions local shape function r on element r contributes to.

For a triplet (c,r,i), globalindex is the index in the Basis of the i-th basis function that has a contribution from local shape function r on element r. coefficient is the coefficient of that contribution in the linear combination defining that basis function in terms of local shape function.

Note: the indices c correspond to the position of the corresponding element whilst iterating over geometry(basis).

source
BEAST.geometryFunction
geometry(basis)

Returns an iterable collection of geometric elements on which the functions in basis are defined. The order the elements are encountered needs correspond to the element indices used in the data structure returned by assemblydata.

source
BEAST.refspaceFunction
refspace(basis)

Returns the ReferenceSpace of local shape functions on which the basis is built.

source
BEAST.quaddataFunction
quaddata(operator, test_refspace, trial_refspace, test_elements, trial_elements)

Returns an object cashing data required for the computation of boundary element interactions. It is up to the client programmer to decide what (if any) data is cached. For double numberical quadrature, storing the integration points for example can significantly speed up matrix assembly.

  • operator is an integration kernel.
  • test_refspace and trial_refspace are reference space objects. quadata

is typically overloaded on the type of these local spaces of shape functions. (See the implementation in maxwell.jl for an example).

  • test_elements and trial_elements are iterable collections of the geometric

elements on which the finite element space are defined. These are provided to allow computation of the actual integrations points - as opposed to only their coordinates.

source
BEAST.quadruleFunction
quadrule(operator,test_refspace,trial_refspace,p,test_element,q_trial_element, qd)

Returns an object that contains all the dynamic (runtime) information that defines the integration strategy that will be used by momintegrals! to compute the interactions between the local test/trial functions defined on the specified geometric elements. The indices p and q refer to the position of the test and trial elements as encountered during iteration over the output of geometry.

The last argument qd provides access to all precomputed data required for quadrature. For example it might be desirable to precompute all the quadrature points for all possible numerical quadrature schemes that can potentially be required during matrix assembly. This makes sense, since the number of point is order N (where N is the number of faces) but these points will appear in N^2 computations. Precomputation requires some extra memory but can save a lot on computation time.

source
BEAST.momintegrals!Function
regularcellcellinteractions!(biop, tshs, bshs, tcell, bcell, interactions, strat)

Function for the computation of moment integrals using simple double quadrature.

source
+BEAST.jl documentation · BEAST Documentation

BEAST.jl documentation

BEAST provides a number of types modelling concepts and a number of algorithms for the efficient and simple implementation of boundary and finite element solvers. It provides full implementations of these concepts for the LU based solution of boundary integral equations for the Maxwell and Helmholtz systems.

Because Julia only compiles code at execution time, users of this library can hook into the code provided in this package at any level. In the extreme case it suffices to provide overwrites of the assemble functions. In that case, only the LU solution will be performed by the code here.

At the other end it suffices that users only supply integration kernels that act on the element-element interaction level. This package will manage all required steps for matrix assembly.

For the Helmholtz 2D and Maxwell 3D systems, complete implementations are supplied. These models will be discussed in detail to give a more concrete idea of the APIs provides and how to extend them.

Central to the solution of boundary integral equations is the assembly of the system matrix. The system matrix is fully determined by specifying a kernel G, a set of trial functions, and a set of test functions.

Basis

Sets of both trial and testing functions are implemented by models following the basis concept. The term basis is somewhat misleading as it is nowhere required nor enforced that these functions are linearly independent. Models implementing the Basis concept need to comply to the following semantics.

  • numfunctions(basis): number of functions in the Basis.
  • coordtype(basis): type of (the components of) the values taken on by the functions in the Basis.
  • scalartype(d): the scalar field underlying the vector space the basis functions take value in.
  • refspace(basis): returns the ReferenceSpace of local shape functions on which the Basis is built.
  • assemblydata(basis): assemblydata returns an iterable collection elements of geometric elements and a look table ad for use in assembly of interaction matrices. In particular, for an index element_idx into elements and an index local_shape_idx in basis of local shape functions refspace(basis), ad[element_idx, local_shape_idx] returns the iterable collection of (global_idx, weight) tuples such that the local shape function at local_shape_idx defined on the element at element_idx contributes to the basis function at global_idx with a weight of weight.
  • geometry(basis): returns an iterable collection of Elements. The order in which these Elements are encountered corresponds to the indices used in the assembly data structure.

Reference Space

The reference space concept defines an API for working with spaces of local shape functions. The main role of objects implementing this concept is to allow specialization of the functions that depend on the precise reference space used.

The functions that depend on the type and value of arguments modeling reference space are:

Kernel

A kernel is a fairly simple concept that mainly exists as part of the definition of a Discrete Operator. A kernel should obey the following semantics:

In many function definitions the kernel object is referenced by operator or something similar. This is a misleading name as an operator definition should always be accompanied by the domain and range space.

Discrete Operator

Informally speaking, a Discrete Operator is a concept that allows for the computation of an interaction matrix. It is a kernel together with a test and trial basis. A Discrete Operator can be passed to assemble and friends to compute its matrix representation.

A discrete operator is a triple (kernel, test_basis, trial_basis), where kernel is a Kernel, and test_basis and trial_basis are Bases. In addition, the following expressions should be implemented and behave according to the correct semantics:

In the context of fast methods such as the Fast Multipole Method other algorithms on Discrete Operators will typically be defined to compute matrix vector products. These algorithms do not explicitly compute and store the interaction matrix (this would lead to unacceptable computational and memory complexity).

BEAST.elementsFunction

elements(geo)

Create an iterable collection of the elements stored in geo. The order in which this collection produces the elements determines the index used for lookup in the data structures returned by assemblydata and quaddata.

source
CompScienceMeshes.coordtypeFunction
coordtype(mesh)

Returns eltype(vertextype(mesh))

coordtype(simplex)

Return coordinate type used by simplex.

BEAST.scalartypeFunction
scalartype(x)

The scalar field over which the values of a global or local basis function, or an operator are defined. This should always be a scalar type, even if the basis or operator takes on values in a vector or tensor space. This data type is used to determine the eltype of assembled discrete operators.

source
BEAST.assemblydataFunction
charts, admap = assemblydata(basis)

Given a Basis this function returns a data structure containing the information required for matrix assemble. More precise the following expressions are valid for the returned object ad:

ad[c,r,i].globalindex
+ad[c,r,i].coefficient

Here, c and r are indices in the iterable set of geometric elements and the set of local shape functions on each element. i ranges from 1 to the maximum number of basis functions local shape function r on element r contributes to.

For a triplet (c,r,i), globalindex is the index in the Basis of the i-th basis function that has a contribution from local shape function r on element r. coefficient is the coefficient of that contribution in the linear combination defining that basis function in terms of local shape function.

Note: the indices c correspond to the position of the corresponding element whilst iterating over geometry(basis).

source
BEAST.geometryFunction
geometry(basis)

Returns an iterable collection of geometric elements on which the functions in basis are defined. The order the elements are encountered needs correspond to the element indices used in the data structure returned by assemblydata.

source
BEAST.refspaceFunction
refspace(basis)

Returns the ReferenceSpace of local shape functions on which the basis is built.

source
BEAST.quaddataFunction
quaddata(operator, test_refspace, trial_refspace, test_elements, trial_elements)

Returns an object cashing data required for the computation of boundary element interactions. It is up to the client programmer to decide what (if any) data is cached. For double numberical quadrature, storing the integration points for example can significantly speed up matrix assembly.

  • operator is an integration kernel.
  • test_refspace and trial_refspace are reference space objects. quadata

is typically overloaded on the type of these local spaces of shape functions. (See the implementation in maxwell.jl for an example).

  • test_elements and trial_elements are iterable collections of the geometric

elements on which the finite element space are defined. These are provided to allow computation of the actual integrations points - as opposed to only their coordinates.

source
BEAST.quadruleFunction
quadrule(operator,test_refspace,trial_refspace,p,test_element,q_trial_element, qd)

Returns an object that contains all the dynamic (runtime) information that defines the integration strategy that will be used by momintegrals! to compute the interactions between the local test/trial functions defined on the specified geometric elements. The indices p and q refer to the position of the test and trial elements as encountered during iteration over the output of geometry.

The last argument qd provides access to all precomputed data required for quadrature. For example it might be desirable to precompute all the quadrature points for all possible numerical quadrature schemes that can potentially be required during matrix assembly. This makes sense, since the number of point is order N (where N is the number of faces) but these points will appear in N^2 computations. Precomputation requires some extra memory but can save a lot on computation time.

source
BEAST.momintegrals!Function
regularcellcellinteractions!(biop, tshs, bshs, tcell, bcell, interactions, strat)

Function for the computation of moment integrals using simple double quadrature.

source
diff --git a/dev/quadstrat/index.html b/dev/quadstrat/index.html index d9a30a21..6d155652 100644 --- a/dev/quadstrat/index.html +++ b/dev/quadstrat/index.html @@ -48,4 +48,4 @@ function momintegrals(op, tel, bel, qr::HighPrecisionQR) ... -end +end diff --git a/dev/search/index.html b/dev/search/index.html index 3322bc9b..74aa182a 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · BEAST Documentation

Loading search...

    +Search · BEAST Documentation

    Loading search...

      diff --git a/dev/tdefie/index.html b/dev/tdefie/index.html index c6c86764..b062b519 100644 --- a/dev/tdefie/index.html +++ b/dev/tdefie/index.html @@ -33,4 +33,4 @@ mat"clf" patch(geo, real.(norm.(fcr))) mat"cd($(pwd()))" -mat"print('current.png', '-dpng')" +mat"print('current.png', '-dpng')" diff --git a/dev/tutorial/index.html b/dev/tutorial/index.html index 9c70d03f..cea2d6ab 100644 --- a/dev/tutorial/index.html +++ b/dev/tutorial/index.html @@ -16,4 +16,4 @@ efie = @discretise t[k,j]==e[k] j∈X k∈X

      Solving and computing the values of the induced current in the centers of the triangles of the mesh is now straightforward:

      u = solve(efie)
       fcr, geo = facecurrents(u,X)
      dots out of 10: ..........
       Converting system to Matrix...done.
      -LU solution of the linear system...done.

      The resulting current distribution can be visualised by e.g. Matlab, Paraview, Plotly,...

      +LU solution of the linear system...done.

      The resulting current distribution can be visualised by e.g. Matlab, Paraview, Plotly,...