diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 4c17cae..f677a37 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-05T19:43:02","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-05T22:14:51","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/dev/bilinearoperator/index.html b/dev/bilinearoperator/index.html index 7a0ee1d..106d516 100644 --- a/dev/bilinearoperator/index.html +++ b/dev/bilinearoperator/index.html @@ -3,25 +3,25 @@ A::AbstractMatrix, u_test, u_ansatz = u_test; - kwargs...)

Generates a bilinear form from a user-provided matrix, which can be a sparse matrix or a FEMatrix with multiple blocks. The arguments utest and uansatz specify where to put the (blocks of the) matrix in the system.

source
ExtendableFEM.BilinearOperatorType
function BilinearOperator(
+	kwargs...)

Generates a bilinear form from a user-provided matrix, which can be a sparse matrix or a FEMatrix with multiple blocks. The arguments utest and uansatz specify where to put the (blocks of the) matrix in the system.

source
ExtendableFEM.BilinearOperatorType
function BilinearOperator(
 	[kernel!::Function],
 	oa_test::Array{<:Tuple{Union{Unknown,Int}, DataType},1},
 	oa_ansatz::Array{<:Tuple{Union{Unknown,Int}, DataType},1} = oa_test;
-	kwargs...)

Generates a bilinear form that evaluates the vector product of the operator evaluation(s) of the test function(s) with the operator evaluation(s) of the ansatz function(s). If a function is provided in the first argument, the ansatz function evaluations can be customized by the kernel function and its result vector is then used in a dot product with the test function evaluations. In this case the header of the kernel functions needs to be conform to the interface

kernel!(result, eval_ansatz, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Example: BilinearOperator([grad(1)], [grad(1)]; kwargs...) generates a weak Laplace operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONCELLS

  • entry_tolerance: threshold to add entry to sparse matrix. Default: 0

  • factor: factor that should be multiplied during assembly. Default: 1

  • lump: diagonal lumping (=0 no lumping, =1 only keep diagonal entry, =2 accumulate full row to diagonal). Default: 0

  • name: name for operator used in printouts. Default: ''BilinearOperator''

  • parallel: assemble operator in parallel using colors/partitions information (assembles into full matrix directly). Default: false

  • parallel_groups: assemble operator in parallel using CellAssemblyGroups (assembles seperated matrices that are added together sequantially). Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • transposed_copy: assemble a transposed copy of that operator into the transposed matrix block(s), 0 = no, 1 = symmetric, -1 = skew-symmetric. Default: 0

  • use_sparsity_pattern: read sparsity pattern of jacobian of kernel to find out which components couple. Default: ''auto''

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.BilinearOperatorMethod
function BilinearOperator(
+	kwargs...)

Generates a bilinear form that evaluates the vector product of the operator evaluation(s) of the test function(s) with the operator evaluation(s) of the ansatz function(s). If a function is provided in the first argument, the ansatz function evaluations can be customized by the kernel function and its result vector is then used in a dot product with the test function evaluations. In this case the header of the kernel functions needs to be conform to the interface

kernel!(result, eval_ansatz, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Example: BilinearOperator([grad(1)], [grad(1)]; kwargs...) generates a weak Laplace operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONCELLS

  • entry_tolerance: threshold to add entry to sparse matrix. Default: 0

  • factor: factor that should be multiplied during assembly. Default: 1

  • lump: diagonal lumping (=0 no lumping, =1 only keep diagonal entry, =2 accumulate full row to diagonal). Default: 0

  • name: name for operator used in printouts. Default: ''BilinearOperator''

  • parallel: assemble operator in parallel using colors/partitions information (assembles into full matrix directly). Default: false

  • parallel_groups: assemble operator in parallel using CellAssemblyGroups (assembles seperated matrices that are added together sequantially). Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • transposed_copy: assemble a transposed copy of that operator into the transposed matrix block(s), 0 = no, 1 = symmetric, -1 = skew-symmetric. Default: 0

  • use_sparsity_pattern: read sparsity pattern of jacobian of kernel to find out which components couple. Default: ''auto''

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.BilinearOperatorMethod
function BilinearOperator(
 	kernel::Function,
 	oa_test::Array{<:Tuple{Union{Unknown,Int}, DataType},1},
 	oa_ansatz::Array{<:Tuple{Union{Unknown,Int}, DataType},1},
 	oa_args::Array{<:Tuple{Union{Unknown,Int}, DataType},1};
-	kwargs...)

Generates a nonlinear bilinear form that evaluates a kernel function that depends on the operator evaluation(s) of the ansatz function(s) and the operator evaluations of the current solution. The result of the kernel function is used in a vector product with the operator evaluation(s) of the test function(s). Hence, this can be used as a linearization of a nonlinear operator. The header of the kernel functions needs to be conform to the interface

kernel!(result, eval_ansatz, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Example: BilinearOperator([grad(1)], [grad(1)]; kwargs...) generates a weak Laplace operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONCELLS

  • entry_tolerance: threshold to add entry to sparse matrix. Default: 0

  • factor: factor that should be multiplied during assembly. Default: 1

  • lump: diagonal lumping (=0 no lumping, =1 only keep diagonal entry, =2 accumulate full row to diagonal). Default: 0

  • name: name for operator used in printouts. Default: ''BilinearOperator''

  • parallel: assemble operator in parallel using colors/partitions information (assembles into full matrix directly). Default: false

  • parallel_groups: assemble operator in parallel using CellAssemblyGroups (assembles seperated matrices that are added together sequantially). Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • transposed_copy: assemble a transposed copy of that operator into the transposed matrix block(s), 0 = no, 1 = symmetric, -1 = skew-symmetric. Default: 0

  • use_sparsity_pattern: read sparsity pattern of jacobian of kernel to find out which components couple. Default: ''auto''

  • verbosity: verbosity level. Default: 0

source

BilinearOperatorDG

BilinearOperatorDG is intended for bilinear forms that involves jumps of discontinuous quantities on faces whose assembly requires evaluation of all degrees of freedom on the neighbouring cells, e.g. gradient jumps for H1 conforming functions. In this case the assembly loop triggers integration along the boundary of the cells.

ExtendableFEM.BilinearOperatorDGType
function BilinearOperatorDG(
+	kwargs...)

Generates a nonlinear bilinear form that evaluates a kernel function that depends on the operator evaluation(s) of the ansatz function(s) and the operator evaluations of the current solution. The result of the kernel function is used in a vector product with the operator evaluation(s) of the test function(s). Hence, this can be used as a linearization of a nonlinear operator. The header of the kernel functions needs to be conform to the interface

kernel!(result, eval_ansatz, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Example: BilinearOperator([grad(1)], [grad(1)]; kwargs...) generates a weak Laplace operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONCELLS

  • entry_tolerance: threshold to add entry to sparse matrix. Default: 0

  • factor: factor that should be multiplied during assembly. Default: 1

  • lump: diagonal lumping (=0 no lumping, =1 only keep diagonal entry, =2 accumulate full row to diagonal). Default: 0

  • name: name for operator used in printouts. Default: ''BilinearOperator''

  • parallel: assemble operator in parallel using colors/partitions information (assembles into full matrix directly). Default: false

  • parallel_groups: assemble operator in parallel using CellAssemblyGroups (assembles seperated matrices that are added together sequantially). Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • transposed_copy: assemble a transposed copy of that operator into the transposed matrix block(s), 0 = no, 1 = symmetric, -1 = skew-symmetric. Default: 0

  • use_sparsity_pattern: read sparsity pattern of jacobian of kernel to find out which components couple. Default: ''auto''

  • verbosity: verbosity level. Default: 0

source

BilinearOperatorDG

BilinearOperatorDG is intended for bilinear forms that involves jumps of discontinuous quantities on faces whose assembly requires evaluation of all degrees of freedom on the neighbouring cells, e.g. gradient jumps for H1 conforming functions. In this case the assembly loop triggers integration along the boundary of the cells.

ExtendableFEM.BilinearOperatorDGType
function BilinearOperatorDG(
 	[kernel!::Function],
 	oa_test::Array{<:Tuple{Union{Unknown,Int}, DataType},1},
 	oa_ansatz::Array{<:Tuple{Union{Unknown,Int}, DataType},1} = oa_test;
-	kwargs...)

Generates a bilinear form that evaluates the vector product of the (discontinuous) operator evaluation(s) of the test function(s) with the (discontinuous) operator evaluation(s) of the ansatz function(s). If a function is provided in the first argument, the ansatz function evaluations can be customized by the kernel function and its result vector is then used in a dot product with the test function evaluations. In this case the header of the kernel functions needs to be conform to the interface

kernel!(result, eval_ansatz, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Example: BilinearOperatorDG([jump(grad(1))], [jump(grad(1))]; kwargs...) generates an interior penalty stabilisation.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • callback!: function with interface (A, b, sol) that is called in each assembly step. Default: nothing

  • entities: assemble operator on these grid entities (default = ONFACES). Default: ONFACES

  • entry_tolerance: threshold to add entry to sparse matrix. Default: 0

  • factor: factor that should be multiplied during assembly. Default: 1

  • lump: lump the operator (= only assemble the diagonal). Default: false

  • name: name for operator used in printouts. Default: ''BilinearOperatorDG''

  • parallel: assemble operator in parallel using colors/partitions information (assembles into full matrix directly). Default: false

  • parallel_groups: assemble operator in parallel using CellAssemblyGroups (assembles seperated matrices that are added together sequantially). Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • transposed_copy: assemble a transposed copy of that operator into the transposed matrix block(s), 0 = no, 1 = symmetric, -1 = skew-symmetric. Default: 0

  • use_sparsity_pattern: read sparsity pattern of jacobian of kernel to find out which components couple. Default: ''auto''

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.BilinearOperatorDGMethod
function BilinearOperatorDG(
+	kwargs...)

Generates a bilinear form that evaluates the vector product of the (discontinuous) operator evaluation(s) of the test function(s) with the (discontinuous) operator evaluation(s) of the ansatz function(s). If a function is provided in the first argument, the ansatz function evaluations can be customized by the kernel function and its result vector is then used in a dot product with the test function evaluations. In this case the header of the kernel functions needs to be conform to the interface

kernel!(result, eval_ansatz, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Example: BilinearOperatorDG([jump(grad(1))], [jump(grad(1))]; kwargs...) generates an interior penalty stabilisation.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • callback!: function with interface (A, b, sol) that is called in each assembly step. Default: nothing

  • entities: assemble operator on these grid entities (default = ONFACES). Default: ONFACES

  • entry_tolerance: threshold to add entry to sparse matrix. Default: 0

  • factor: factor that should be multiplied during assembly. Default: 1

  • lump: lump the operator (= only assemble the diagonal). Default: false

  • name: name for operator used in printouts. Default: ''BilinearOperatorDG''

  • parallel: assemble operator in parallel using colors/partitions information (assembles into full matrix directly). Default: false

  • parallel_groups: assemble operator in parallel using CellAssemblyGroups (assembles seperated matrices that are added together sequantially). Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • transposed_copy: assemble a transposed copy of that operator into the transposed matrix block(s), 0 = no, 1 = symmetric, -1 = skew-symmetric. Default: 0

  • use_sparsity_pattern: read sparsity pattern of jacobian of kernel to find out which components couple. Default: ''auto''

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.BilinearOperatorDGMethod
function BilinearOperatorDG(
 	kernel::Function,
 	oa_test::Array{<:Tuple{Union{Unknown,Int}, DataType},1},
 	oa_ansatz::Array{<:Tuple{Union{Unknown,Int}, DataType},1},
 	oa_args::Array{<:Tuple{Union{Unknown,Int}, DataType},1};
-	kwargs...)

Generates a nonlinear bilinear form that evaluates a kernel function that depends on the (discontinuou) operator evaluation(s) of the ansatz function(s) and the (discontinuous) operator evaluations of the current solution. The result of the kernel function is used in a vector product with the operator evaluation(s) of the test function(s). Hence, this can be used as a linearization of a nonlinear operator. The header of the kernel functions needs to be conform to the interface

kernel!(result, eval_ansatz, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONCELLS

  • entry_tolerance: threshold to add entry to sparse matrix. Default: 0

  • factor: factor that should be multiplied during assembly. Default: 1

  • lump: diagonal lumping (=0 no lumping, =1 only keep diagonal entry, =2 accumulate full row to diagonal). Default: 0

  • name: name for operator used in printouts. Default: ''BilinearOperator''

  • parallel: assemble operator in parallel using colors/partitions information (assembles into full matrix directly). Default: false

  • parallel_groups: assemble operator in parallel using CellAssemblyGroups (assembles seperated matrices that are added together sequantially). Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • transposed_copy: assemble a transposed copy of that operator into the transposed matrix block(s), 0 = no, 1 = symmetric, -1 = skew-symmetric. Default: 0

  • use_sparsity_pattern: read sparsity pattern of jacobian of kernel to find out which components couple. Default: ''auto''

  • verbosity: verbosity level. Default: 0

source

Examples

Below two examples illustrate some use cases.

Example - Stokes operator

For the linear operator of a Stokes problem a kernel could look like

μ = 0.1 # viscosity parameter
+	kwargs...)

Generates a nonlinear bilinear form that evaluates a kernel function that depends on the (discontinuou) operator evaluation(s) of the ansatz function(s) and the (discontinuous) operator evaluations of the current solution. The result of the kernel function is used in a vector product with the operator evaluation(s) of the test function(s). Hence, this can be used as a linearization of a nonlinear operator. The header of the kernel functions needs to be conform to the interface

kernel!(result, eval_ansatz, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Keyword arguments:

source

Examples

Below two examples illustrate some use cases.

Example - Stokes operator

For the linear operator of a Stokes problem a kernel could look like

μ = 0.1 # viscosity parameter
 function kernel!(result, input, qpinfo)
     ∇u, p = view(input,1:4), view(input, 5)
     result[1] = μ*∇u[1] - p[1]
@@ -35,4 +35,4 @@
 BilinearOperator(kernel!, [grad(u), id(p)]; use_sparsity_pattern = true)

The additional argument causes that the zero pressure-pressure block of the matrix is not (even tried to be) assembled, since input[5] does not couple with result[5].

Example - interior penalty stabilization

A popular convection stabilization is based on the jumps of the gradient, which can be realised with the kernel

function stab_kernel!(result, input, qpinfo)
     result .= input .* qpinfo.volume^2
 end

and the BilinearOperatorDG constructor call

u = Unknown("u")
-assign_operator!(PD, BilinearOperatorDG(stab_kernel!, [jump(grad(u))]; entities = ON_IFACES, factor = 0.01))
+assign_operator!(PD, BilinearOperatorDG(stab_kernel!, [jump(grad(u))]; entities = ON_IFACES, factor = 0.01)) diff --git a/dev/callbackoperator/index.html b/dev/callbackoperator/index.html index d9e1e8d..9cb9611 100644 --- a/dev/callbackoperator/index.html +++ b/dev/callbackoperator/index.html @@ -2,4 +2,4 @@ CallbackOperator · ExtendableFEM.jl

CallbackOperator

A callback operator passes the matrix and rhs to a user-defined function where they can be modified as desired. An example where this is used is Example265.

Constructors

ExtendableFEM.CallbackOperatorType
function CallbackOperator(
 	callback!::Function,
 	u_args = [];
-	kwargs...)

Generates an operator that simply passes the matrix and rhs to a user-specified call back function. The callback function needs to be conform to the interface

callback!(A, b, args; assemble_matrix = true, assemble_rhs = true, time = 0, kwargs...)

The u_args argument can be used to specify the arguments of the solution that should be passed as args (a vector of FEVectorBlocks) to the callback.

Keyword arguments:

  • linearized_dependencies: [uansatz, utest] when linearized. Default: auto

  • modifies_matrix: callback function modifies the matrix?. Default: true

  • modifies_rhs: callback function modifies the rhs?. Default: true

  • name: name for operator used in printouts. Default: ''CallbackOperator''

  • store: store matrix and rhs separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • verbosity: verbosity level. Default: 0

source
+ kwargs...)

Generates an operator that simply passes the matrix and rhs to a user-specified call back function. The callback function needs to be conform to the interface

callback!(A, b, args; assemble_matrix = true, assemble_rhs = true, time = 0, kwargs...)

The u_args argument can be used to specify the arguments of the solution that should be passed as args (a vector of FEVectorBlocks) to the callback.

Keyword arguments:

source diff --git a/dev/combinedofs/index.html b/dev/combinedofs/index.html index f47cae3..48f3839 100644 --- a/dev/combinedofs/index.html +++ b/dev/combinedofs/index.html @@ -1,2 +1,2 @@ -CombineDofs · ExtendableFEM.jl

CombineDofs

ExtendableFEM.CombineDofsType
function CombineDofs(uX, uY, dofsX, dofsY, factors; kwargs...)

When assembled, the dofsX of the unknown uX will be coupled with the dofsY of uY, e.g., for periodic boundary conditions.

Keyword arguments:

  • penalty: penalty for fixed degrees of freedom. Default: 1.0e30

  • verbosity: verbosity level. Default: 0

source

The following function might be useful to find out the dofs the need to be coupled for periodic boundary conditions:

ExtendableFEM.get_periodic_coupling_infoFunction
function get_periodic_coupling_info(FES, xgrid, b1, b2, is_opposite::Function; factor_vectordofs = "auto")

computes the dofs that have to be coupled for periodic boundary conditions on the given xgrid for boundary regions b1, b2. The isopposite function evaluates if two provided face midpoints are on opposite sides to each other (the mesh xgrid should be appropriate). For vector-valued FETypes the user can provide factorvectordofs to incorporate a sign change if needed. This is automatically done for all Hdiv-conforming elements and (for the normal-weighted face bubbles of) the Bernardi-Raugel element H1BR.

source
+CombineDofs · ExtendableFEM.jl

CombineDofs

ExtendableFEM.CombineDofsType
function CombineDofs(uX, uY, dofsX, dofsY, factors; kwargs...)

When assembled, the dofsX of the unknown uX will be coupled with the dofsY of uY, e.g., for periodic boundary conditions.

Keyword arguments:

  • penalty: penalty for fixed degrees of freedom. Default: 1.0e30

  • verbosity: verbosity level. Default: 0

source

The following function might be useful to find out the dofs the need to be coupled for periodic boundary conditions:

ExtendableFEM.get_periodic_coupling_infoFunction
function get_periodic_coupling_info(FES, xgrid, b1, b2, is_opposite::Function; factor_vectordofs = "auto")

computes the dofs that have to be coupled for periodic boundary conditions on the given xgrid for boundary regions b1, b2. The isopposite function evaluates if two provided face midpoints are on opposite sides to each other (the mesh xgrid should be appropriate). For vector-valued FETypes the user can provide factorvectordofs to incorporate a sign change if needed. This is automatically done for all Hdiv-conforming elements and (for the normal-weighted face bubbles of) the Bernardi-Raugel element H1BR.

source
diff --git a/dev/examples_intro/index.html b/dev/examples_intro/index.html index 842a1d1..7cec368 100644 --- a/dev/examples_intro/index.html +++ b/dev/examples_intro/index.html @@ -1,4 +1,4 @@ About the examples · ExtendableFEM.jl

About the examples

The examples have been designed with the following issues in mind:

  • they run from the Julia REPL
  • each example is a Julia module named similar to the basename of the example file.
  • an example can be used as the starting point for a project
  • some examples define test cases for the test suite
  • ExampleXYZ with X = A can be considered advanced and uses low-level structures and/or demonstrates customisation features or experimental features
  • the default output of the main function is printed on the website and can be used to check if the code runs as expected (unfortunately REPL messages are not recorded)
  • printed assembly and solving times (especially in a first iteration) can be much larger due to first-run compilation times, the printouts in the documentation are taken from a second run after compilations are done

Running the examples

In order to run ExampleXXX, peform the following steps:

  • Download the example file (e.g. via the source code link at the top)
  • Make sure all used packages are installed in your Julia environment
  • In the REPL:
julia> include("ExampleXXX.jl")`
 
-julia> ExampleXXX.main()
  • Some examples offer visual output via the optional argument Plotter = PyPlot or Plotter = GLMakie

(provided the package PyPlot/GLMakie is installed and loaded)

+julia> ExampleXXX.main()

(provided the package PyPlot/GLMakie is installed and loaded)

diff --git a/dev/fixdofs/index.html b/dev/fixdofs/index.html index 6841b50..65db728 100644 --- a/dev/fixdofs/index.html +++ b/dev/fixdofs/index.html @@ -1,2 +1,2 @@ -FixDofs · ExtendableFEM.jl

FixDofs

ExtendableFEM.FixDofsMethod
function FixDofs(u; vals = [], dofs = [], kwargs...)

When assembled, all specified dofs of the unknown u will be penalized to the specified values.

Keyword arguments:

  • name: name for operator used in printouts. Default: ''FixDofs''

  • penalty: penalty for fixed degrees of freedom. Default: 1.0e30

  • verbosity: verbosity level. Default: 0

source
+FixDofs · ExtendableFEM.jl

FixDofs

ExtendableFEM.FixDofsMethod
function FixDofs(u; vals = [], dofs = [], kwargs...)

When assembled, all specified dofs of the unknown u will be penalized to the specified values.

Keyword arguments:

  • name: name for operator used in printouts. Default: ''FixDofs''

  • penalty: penalty for fixed degrees of freedom. Default: 1.0e30

  • verbosity: verbosity level. Default: 0

source
diff --git a/dev/homogeneousdata/index.html b/dev/homogeneousdata/index.html index f58fc5e..dcce86e 100644 --- a/dev/homogeneousdata/index.html +++ b/dev/homogeneousdata/index.html @@ -1,2 +1,2 @@ -HomogeneousData · ExtendableFEM.jl

HomogeneousData

ExtendableFEM.HomogeneousDataMethod
function HomogeneousData(u; entities = ON_CELLS, kwargs...)

When assembled, the unknown u of the Problem will be penalized to zero on the specifies entities and entity regions (via kwargs).

Keyword arguments:

  • mask: array of zeros/ones to set which components should be set by the operator (only works with componentwise dofs, add a 1 or 0 to mask additional dofs). Default: Any[]

  • name: name for operator used in printouts. Default: ''HomogeneousData''

  • penalty: penalty for fixed degrees of freedom. Default: 1.0e30

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • value: constant value of the data. Default: 0

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.HomogeneousBoundaryDataMethod
function HomogeneousBoundaryData(u; entities = ON_BFACES, kwargs...)

When assembled, the unknown u of the Problem will be penalized to zero on the boundary faces and boundary regions (via kwargs).

Keyword arguments:

  • mask: array of zeros/ones to set which components should be set by the operator (only works with componentwise dofs, add a 1 or 0 to mask additional dofs). Default: Any[]

  • name: name for operator used in printouts. Default: ''HomogeneousData''

  • penalty: penalty for fixed degrees of freedom. Default: 1.0e30

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • value: constant value of the data. Default: 0

  • verbosity: verbosity level. Default: 0

source
+HomogeneousData · ExtendableFEM.jl

HomogeneousData

ExtendableFEM.HomogeneousDataMethod
function HomogeneousData(u; entities = ON_CELLS, kwargs...)

When assembled, the unknown u of the Problem will be penalized to zero on the specifies entities and entity regions (via kwargs).

Keyword arguments:

  • mask: array of zeros/ones to set which components should be set by the operator (only works with componentwise dofs, add a 1 or 0 to mask additional dofs). Default: Any[]

  • name: name for operator used in printouts. Default: ''HomogeneousData''

  • penalty: penalty for fixed degrees of freedom. Default: 1.0e30

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • value: constant value of the data. Default: 0

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.HomogeneousBoundaryDataMethod
function HomogeneousBoundaryData(u; entities = ON_BFACES, kwargs...)

When assembled, the unknown u of the Problem will be penalized to zero on the boundary faces and boundary regions (via kwargs).

Keyword arguments:

  • mask: array of zeros/ones to set which components should be set by the operator (only works with componentwise dofs, add a 1 or 0 to mask additional dofs). Default: Any[]

  • name: name for operator used in printouts. Default: ''HomogeneousData''

  • penalty: penalty for fixed degrees of freedom. Default: 1.0e30

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • value: constant value of the data. Default: 0

  • verbosity: verbosity level. Default: 0

source
diff --git a/dev/index.html b/dev/index.html index 6899acf..853d722 100644 --- a/dev/index.html +++ b/dev/index.html @@ -20,4 +20,4 @@ # interpolate some given function u!(result, qpinfo) interpolate!(sol[u], u!)

4. Solve

Here, we solve the problem. If the problem is nonlinear, several additional arguments allow to steer the fixed-point iteration, see Stationary Solvers. In the simplest case, the user only needs to call:

# solve problem with finite element space(s)
 # (in case of more than one unknown, provide a vector of FESpaces)
-sol = solve(PD, FES; init = sol)

For time-dependent problem, the user can add the necessary operators for the time derivative manually. Alternatively, the problem description in space can be turned into an ODE and solve via DifferentialEquations.jl, see Time-dependent Solvers for details.

Also note, that the use can bypass the problem description and control the algebraic level manually via assembling the operators directly into an FEMatrix, see e.g. Example310. It is also possible to take control over the low-level assembly of the operators, see ExtendableFEMBase.jl for details.

5. Plot and postprocess

After solving, the user can postprocess the solution, calculate quantities of interest or plot components.

Gradient-robustness

This package offers some ingredients to build gradient-robust schemes via reconstruction operators or divergence-free elements. Gradient-robustness is a feature of discretisations that exactly balance gradient forces in the momentum balance. In the case of the incompressible Navier–Stokes equations this means that the discrete velocity does not depend on the exact pressure. Divergence-free finite element methods have this property but are usually expensive and difficult to contruct. However, also non-divergence-free classical finite element methods can be made pressure-robust with the help of reconstruction operators applied to testfunctions in certain terms of the momentum balance, see e.g. references [1,2] below.

Recently gradient-robustness was also connected to the design of well-balanced schemes e.g. in the context of (nearly) compressible flows, see e.g. reference [3] below.

References

+sol = solve(PD, FES; init = sol)

For time-dependent problem, the user can add the necessary operators for the time derivative manually. Alternatively, the problem description in space can be turned into an ODE and solve via DifferentialEquations.jl, see Time-dependent Solvers for details.

Also note, that the use can bypass the problem description and control the algebraic level manually via assembling the operators directly into an FEMatrix, see e.g. Example310. It is also possible to take control over the low-level assembly of the operators, see ExtendableFEMBase.jl for details.

5. Plot and postprocess

After solving, the user can postprocess the solution, calculate quantities of interest or plot components.

Gradient-robustness

This package offers some ingredients to build gradient-robust schemes via reconstruction operators or divergence-free elements. Gradient-robustness is a feature of discretisations that exactly balance gradient forces in the momentum balance. In the case of the incompressible Navier–Stokes equations this means that the discrete velocity does not depend on the exact pressure. Divergence-free finite element methods have this property but are usually expensive and difficult to contruct. However, also non-divergence-free classical finite element methods can be made pressure-robust with the help of reconstruction operators applied to testfunctions in certain terms of the momentum balance, see e.g. references [1,2] below.

Recently gradient-robustness was also connected to the design of well-balanced schemes e.g. in the context of (nearly) compressible flows, see e.g. reference [3] below.

References

diff --git a/dev/interpolateboundarydata/index.html b/dev/interpolateboundarydata/index.html index 893d2c7..558f1ed 100644 --- a/dev/interpolateboundarydata/index.html +++ b/dev/interpolateboundarydata/index.html @@ -1,2 +1,2 @@ -InterpolateBoundaryData · ExtendableFEM.jl

InterpolateBoundaryData

ExtendableFEM.InterpolateBoundaryDataType
function InterpolateBoundaryData(u, data!::Function; kwargs...)

When assembled, the unknown u of the Problem will be penalized to match the standard interpolation of the provided data! function. The header of this function needs to be conform to the interface

data!(result, qpinfo)

where qpinfo allows to access information at the current quadrature point, e.g. qpinfo.x provides the global coordinates of the quadrature/evaluation point.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to the quadorder chosen by the interpolator. Default: 0

  • name: name for operator used in printouts. Default: ''BoundaryData''

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • penalty: penalty for fixed degrees of freedom. Default: 1.0e30

  • plot: plot unicode plot of boundary data into terminal when assembled. Default: false

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • verbosity: verbosity level. Default: 0

source
+InterpolateBoundaryData · ExtendableFEM.jl

InterpolateBoundaryData

ExtendableFEM.InterpolateBoundaryDataType
function InterpolateBoundaryData(u, data!::Function; kwargs...)

When assembled, the unknown u of the Problem will be penalized to match the standard interpolation of the provided data! function. The header of this function needs to be conform to the interface

data!(result, qpinfo)

where qpinfo allows to access information at the current quadrature point, e.g. qpinfo.x provides the global coordinates of the quadrature/evaluation point.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to the quadorder chosen by the interpolator. Default: 0

  • name: name for operator used in printouts. Default: ''BoundaryData''

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • penalty: penalty for fixed degrees of freedom. Default: 1.0e30

  • plot: plot unicode plot of boundary data into terminal when assembled. Default: false

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • verbosity: verbosity level. Default: 0

source
diff --git a/dev/itemintegrators/index.html b/dev/itemintegrators/index.html index 1c347ba..9156f28 100644 --- a/dev/itemintegrators/index.html +++ b/dev/itemintegrators/index.html @@ -2,35 +2,35 @@ Item Integrators · ExtendableFEM.jl

Item Integrators

Item integrators compute certain quantities of the Solution, like a posteriori errors estimators, norms, drag/lift coefficients or other statistics.

ExtendableFEM.ItemIntegratorMethod
function ItemIntegrator(
 	[kernel!::Function],
 	oa_args::Array{<:Tuple{Union{Unknown,Int}, DataType},1};
-	kwargs...)

Generates an ItemIntegrator that evaluates the specified operator evaluations, puts it into the kernel function and integrates the results over the entities (see kwargs). If no kernel is given, the arguments are integrated directly. If a kernel is provided it has be conform to the interface

kernel!(result, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point. Additionally the length of the result needs to be specified via the kwargs.

Evaluation can be triggered via the evaluate function.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONCELLS

  • factor: factor that should be multiplied during assembly. Default: 1

  • name: name for operator used in printouts. Default: ''ItemIntegrator''

  • parallel: assemble operator in parallel using partitions information. Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • piecewise: returns piecewise integrations, otherwise a global integration. Default: true

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where the item integrator should be evaluated. Default: Any[]

  • resultdim: dimension of result field (default = length of arguments). Default: 0

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.evaluateMethod
function evaluate(
+	kwargs...)

Generates an ItemIntegrator that evaluates the specified operator evaluations, puts it into the kernel function and integrates the results over the entities (see kwargs). If no kernel is given, the arguments are integrated directly. If a kernel is provided it has be conform to the interface

kernel!(result, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point. Additionally the length of the result needs to be specified via the kwargs.

Evaluation can be triggered via the evaluate function.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONCELLS

  • factor: factor that should be multiplied during assembly. Default: 1

  • name: name for operator used in printouts. Default: ''ItemIntegrator''

  • parallel: assemble operator in parallel using partitions information. Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • piecewise: returns piecewise integrations, otherwise a global integration. Default: true

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where the item integrator should be evaluated. Default: Any[]

  • resultdim: dimension of result field (default = length of arguments). Default: 0

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.evaluateMethod
function evaluate(
 	O::ItemIntegrator,
 	sol;
 	time = 0,
-	kwargs...)

Evaluates the ItemIntegrator for the specified solution and returns an matrix of size resultdim x num_items.

source
ExtendableFEMBase.evaluate!Method
function evaluate(
+	kwargs...)

Evaluates the ItemIntegrator for the specified solution and returns an matrix of size resultdim x num_items.

source
ExtendableFEMBase.evaluate!Method
function evaluate(
 	b::AbstractMatrix,
 	O::ItemIntegrator,
 	sol::FEVector;
 	time = 0,
-	kwargs...)

Evaluates the ItemIntegrator for the specified solution into the matrix b.

source
ExtendableFEMBase.evaluate!Method
function evaluate(
 	b::AbstractMatrix,
 	O::ItemIntegrator,
 	sol::Array{FEVEctorBlock};
 	time = 0,
-	kwargs...)

Evaluates the ItemIntegrator for the specified solution into the matrix b.

source

ItemIntegratorDG

ItemIntegratorDG is intended for quantities that involve jumps of discontinuous quantities on faces whose assembly requires evaluation of all degrees of freedom on the neighbouring cells, e.g. gradient jumps for H1 conforming functions or jumps of broken FESpaces. In this case the assembly loop triggers integration along the boundary of the cells.

ItemIntegratorDG

ItemIntegratorDG is intended for quantities that involve jumps of discontinuous quantities on faces whose assembly requires evaluation of all degrees of freedom on the neighbouring cells, e.g. gradient jumps for H1 conforming functions or jumps of broken FESpaces. In this case the assembly loop triggers integration along the boundary of the cells.

ExtendableFEM.ItemIntegratorDGMethod
function ItemIntegratorDG(
 	kernel::Function,
 	oa_args::Array{<:Tuple{Union{Unknown,Int}, DataType},1};
-	kwargs...)

Generates an ItemIntegrator that evaluates the specified (discontinuous) operator evaluations, puts it into the kernel function and integrates the results over the entities (see kwargs) along cell boundaries. If no kernel is given, the arguments are integrated directly. If a kernel is provided it has be conform to the interface

kernel!(result, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point. Additionally the length of the result needs to be specified via the kwargs.

Evaluation can be triggered via the evaluate function.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONFACES

  • factor: factor that should be multiplied during assembly. Default: 1

  • name: name for operator used in printouts. Default: ''ItemIntegratorDG''

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • piecewise: returns piecewise integrations, otherwise a global integration. Default: true

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where the item integrator should be evaluated. Default: Any[]

  • resultdim: dimension of result field (default = length of arguments). Default: 0

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.evaluateMethod
function evaluate(
+	kwargs...)

Generates an ItemIntegrator that evaluates the specified (discontinuous) operator evaluations, puts it into the kernel function and integrates the results over the entities (see kwargs) along cell boundaries. If no kernel is given, the arguments are integrated directly. If a kernel is provided it has be conform to the interface

kernel!(result, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point. Additionally the length of the result needs to be specified via the kwargs.

Evaluation can be triggered via the evaluate function.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONFACES

  • factor: factor that should be multiplied during assembly. Default: 1

  • name: name for operator used in printouts. Default: ''ItemIntegratorDG''

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • piecewise: returns piecewise integrations, otherwise a global integration. Default: true

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where the item integrator should be evaluated. Default: Any[]

  • resultdim: dimension of result field (default = length of arguments). Default: 0

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.evaluateMethod
function evaluate(
 	O::ItemIntegratorDG,
 	sol;
 	time = 0,
-	kwargs...)

Evaluates the ItemIntegratorDG for the specified solution and returns an matrix of size resultdim x num_items.

source
ExtendableFEMBase.evaluate!Method
function evaluate(
+	kwargs...)

Evaluates the ItemIntegratorDG for the specified solution and returns an matrix of size resultdim x num_items.

source
ExtendableFEMBase.evaluate!Method
function evaluate(
 	b::AbstractMatrix,
 	O::ItemIntegratorDG,
 	sol::FEVector;
 	time = 0,
-	kwargs...)

Evaluates the ItemIntegratorDG for the specified solution into the matrix b.

source
ExtendableFEMBase.evaluate!Method
function evaluate(
 	b::AbstractMatrix,
 	O::ItemIntegratorDG,
 	sol::Array{FEVEctorBlock};
 	time = 0,
-	kwargs...)

Evaluates the ItemIntegratorDG for the specified solution into the matrix b.

source
+ kwargs...)

Evaluates the ItemIntegratorDG for the specified solution into the matrix b.

source diff --git a/dev/linearoperator/index.html b/dev/linearoperator/index.html index 1771d6a..4a99650 100644 --- a/dev/linearoperator/index.html +++ b/dev/linearoperator/index.html @@ -3,24 +3,24 @@ A, u_test, u_args; - kwargs...)

Generates a linear form from a user-provided matrix A, which can be an AbstractMatrix or a FEMatrix with multiple blocks. The arguments uargs specify which coefficients of the current solution should be multiplied with the matrix and utest specifies where to put the (blocks of the) resulting vector in the system right-hand side.

source
ExtendableFEM.LinearOperatorMethod
function LinearOperator(
+	kwargs...)

Generates a linear form from a user-provided matrix A, which can be an AbstractMatrix or a FEMatrix with multiple blocks. The arguments uargs specify which coefficients of the current solution should be multiplied with the matrix and utest specifies where to put the (blocks of the) resulting vector in the system right-hand side.

source
ExtendableFEM.LinearOperatorMethod
function LinearOperator(
 	b,
 	u_test;
-	kwargs...)

Generates a linear form from a user-provided vector b, which can be an AbstractVector or a FEVector with multiple blocks. The argument u_test specifies where to put the (blocks of the) vector in the system right-hand side.

source
ExtendableFEM.LinearOperatorMethod
function LinearOperator(
+	kwargs...)

Generates a linear form from a user-provided vector b, which can be an AbstractVector or a FEVector with multiple blocks. The argument u_test specifies where to put the (blocks of the) vector in the system right-hand side.

source
ExtendableFEM.LinearOperatorMethod
function LinearOperator(
 	kernel!::Function,
 	oa_test::Array{<:Tuple{Union{Unknown,Int}, DataType},1},
 	oa_args::Array{<:Tuple{Union{Unknown,Int}, DataType},1};
-	kwargs...)

Generates a nonlinear linear form that evaluates a kernel function that depends on the operator evaluations of the current solution. The result of the kernel function is used in a vector product with the operator evaluation(s) of the test function(s). Hence, this can be used as a linearization of a nonlinear operator. The header of the kernel functions needs to be conform to the interface

kernel!(result, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONCELLS

  • factor: factor that should be multiplied during assembly. Default: 1

  • name: name for operator used in printouts. Default: ''LinearOperator''

  • parallel: assemble operator in parallel using colors/partitions information. Default: false

  • parallel_groups: assemble operator in parallel using CellAssemblyGroups. Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.LinearOperatorMethod
function LinearOperator(
+	kwargs...)

Generates a nonlinear linear form that evaluates a kernel function that depends on the operator evaluations of the current solution. The result of the kernel function is used in a vector product with the operator evaluation(s) of the test function(s). Hence, this can be used as a linearization of a nonlinear operator. The header of the kernel functions needs to be conform to the interface

kernel!(result, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONCELLS

  • factor: factor that should be multiplied during assembly. Default: 1

  • name: name for operator used in printouts. Default: ''LinearOperator''

  • parallel: assemble operator in parallel using colors/partitions information. Default: false

  • parallel_groups: assemble operator in parallel using CellAssemblyGroups. Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.LinearOperatorMethod
function LinearOperator(
 	[kernel!::Function],
 	oa_test::Array{<:Tuple{Union{Unknown,Int}, DataType},1};
-	kwargs...)

Generates a linear form that evaluates, in each quadrature point, the kernel function (if non is provided, a constant function one is used) and computes the vector product of the result with with the operator evaluation(s) of the test function(s). The header of the kernel functions needs to be conform to the interface

kernel!(result, qpinfo)

where qpinfo allows to access information at the current quadrature point, e.g. qpinfo.x are the global coordinates of the quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Example: LinearOperator(kernel!, [id(1)]; kwargs...) generates the right-hand side for a Poisson problem, where kernel! evaluates the right-hand side.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONCELLS). Default: ONCELLS

  • factor: factor that should be multiplied during assembly. Default: 1

  • name: name for operator used in printouts. Default: ''LinearOperator''

  • parallel: assemble operator in parallel using colors/partitions information. Default: false

  • parallel_groups: assemble operator in parallel using CellAssemblyGroups. Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • verbosity: verbosity level. Default: 0

source

Example - right-hand side

For a right-hand side operator of a Poisson problem with some given function f(x) a kernel could look like

function kernel!(result, qpinfo)
+	kwargs...)

Generates a linear form that evaluates, in each quadrature point, the kernel function (if non is provided, a constant function one is used) and computes the vector product of the result with with the operator evaluation(s) of the test function(s). The header of the kernel functions needs to be conform to the interface

kernel!(result, qpinfo)

where qpinfo allows to access information at the current quadrature point, e.g. qpinfo.x are the global coordinates of the quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Example: LinearOperator(kernel!, [id(1)]; kwargs...) generates the right-hand side for a Poisson problem, where kernel! evaluates the right-hand side.

Keyword arguments:

source

Example - right-hand side

For a right-hand side operator of a Poisson problem with some given function f(x) a kernel could look like

function kernel!(result, qpinfo)
     result[1] = f(qpinfo.x)
 end

and the coressponding LinearOperator constructor call reads

u = Unknown("u")
 NonlinearOperator(kernel!, [id(u)])

The second argument triggers that the result vector of the kernel is multiplied with the Identity evaluation of the test function.

LinearOperatorDG

LinearOperatorDG is intended for linear forms that involves jumps of discontinuous quantities on faces whose assembly requires evaluation of all degrees of freedom on the neighbouring cells, e.g. gradient jumps for H1 conforming functions. In this case the assembly loop triggers integration along the boundary of the cells.

ExtendableFEM.LinearOperatorDGMethod
function LinearOperatorDG(
 	kernel::Function,
 	oa_test::Array{<:Tuple{Union{Unknown,Int}, DataType},1},
 	oa_args::Array{<:Tuple{Union{Unknown,Int}, DataType},1};
-	kwargs...)

Generates a nonlinear linear form that evaluates a kernel function that depends on the (discontinous) operator evaluations of the current solution. The result of the kernel function is used in a vector product with the operator evaluation(s) of the test function(s). Hence, this can be used as a linearization of a nonlinear operator. The header of the kernel functions needs to be conform to the interface

kernel!(result, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONFACES). Default: ONFACES

  • entry_tolerance: threshold to add entry to sparse matrix. Default: 0

  • factor: factor that should be multiplied during assembly. Default: 1

  • name: name for operator used in printouts. Default: ''LinearOperatorDG''

  • parallel: assemble operator in parallel using colors/partitions information. Default: false

  • parallel_groups: assemble operator in parallel using FaceAssemblyGroups. Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.LinearOperatorDGMethod
function LinearOperatorDG(
+	kwargs...)

Generates a nonlinear linear form that evaluates a kernel function that depends on the (discontinous) operator evaluations of the current solution. The result of the kernel function is used in a vector product with the operator evaluation(s) of the test function(s). Hence, this can be used as a linearization of a nonlinear operator. The header of the kernel functions needs to be conform to the interface

kernel!(result, eval_args, qpinfo)

where qpinfo allows to access information at the current quadrature point.

Operator evaluations are tuples that pair an unknown identifier or integer with a Function operator.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONFACES). Default: ONFACES

  • entry_tolerance: threshold to add entry to sparse matrix. Default: 0

  • factor: factor that should be multiplied during assembly. Default: 1

  • name: name for operator used in printouts. Default: ''LinearOperatorDG''

  • parallel: assemble operator in parallel using colors/partitions information. Default: false

  • parallel_groups: assemble operator in parallel using FaceAssemblyGroups. Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.LinearOperatorDGMethod
function LinearOperatorDG(
 	[kernel!::Function],
 	oa_test::Array{<:Tuple{Union{Unknown,Int}, DataType},1};
-	kwargs...)

Generates a linear form that evaluates, in each quadrature point, the kernel function (if non is provided, a constant function one is used) and computes the vector product of the result with with the (discontinuous) operator evaluation(s) of the test function(s). The header of the kernel functions needs to be conform to the interface

kernel!(result, qpinfo)

where qpinfo allows to access information at the current quadrature point, e.g. qpinfo.x are the global coordinates of the quadrature point.

Keyword arguments:

  • bonus_quadorder: additional quadrature order added to quadorder. Default: 0

  • entities: assemble operator on these grid entities (default = ONFACES). Default: ONFACES

  • entry_tolerance: threshold to add entry to sparse matrix. Default: 0

  • factor: factor that should be multiplied during assembly. Default: 1

  • name: name for operator used in printouts. Default: ''LinearOperatorDG''

  • parallel: assemble operator in parallel using colors/partitions information. Default: false

  • parallel_groups: assemble operator in parallel using FaceAssemblyGroups. Default: false

  • params: array of parameters that should be made available in qpinfo argument of kernel function. Default: nothing

  • quadorder: quadrature order. Default: ''auto''

  • regions: subset of regions where operator should be assembly only. Default: Any[]

  • store: store matrix separately (and copy from there when reassembly is triggered). Default: false

  • time_dependent: operator is time-dependent ?. Default: false

  • verbosity: verbosity level. Default: 0

source
+ kwargs...)

Generates a linear form that evaluates, in each quadrature point, the kernel function (if non is provided, a constant function one is used) and computes the vector product of the result with with the (discontinuous) operator evaluation(s) of the test function(s). The header of the kernel functions needs to be conform to the interface

kernel!(result, qpinfo)

where qpinfo allows to access information at the current quadrature point, e.g. qpinfo.x are the global coordinates of the quadrature point.

Keyword arguments:

source diff --git a/dev/module_examples/Example103_BurgersEquation/index.html b/dev/module_examples/Example103_BurgersEquation/index.html index a6d20ca..01f55f1 100644 --- a/dev/module_examples/Example103_BurgersEquation/index.html +++ b/dev/module_examples/Example103_BurgersEquation/index.html @@ -84,4 +84,4 @@ return sol, plt end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example105_NonlinearPoissonEquation/index.html b/dev/module_examples/Example105_NonlinearPoissonEquation/index.html index b9857db..67d6138 100644 --- a/dev/module_examples/Example105_NonlinearPoissonEquation/index.html +++ b/dev/module_examples/Example105_NonlinearPoissonEquation/index.html @@ -49,4 +49,4 @@ return sol, plt end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example106_NonlinearDiffusion/index.html b/dev/module_examples/Example106_NonlinearDiffusion/index.html index d33d9b8..c10c879 100644 --- a/dev/module_examples/Example106_NonlinearDiffusion/index.html +++ b/dev/module_examples/Example106_NonlinearDiffusion/index.html @@ -103,4 +103,4 @@ return sol, plt end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example108_RobinBoundaryCondition/index.html b/dev/module_examples/Example108_RobinBoundaryCondition/index.html index 95dd922..3cc7508 100644 --- a/dev/module_examples/Example108_RobinBoundaryCondition/index.html +++ b/dev/module_examples/Example108_RobinBoundaryCondition/index.html @@ -62,4 +62,4 @@ return sol, plt end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example201_PoissonProblem/index.html b/dev/module_examples/Example201_PoissonProblem/index.html index c43cae4..ee385be 100644 --- a/dev/module_examples/Example201_PoissonProblem/index.html +++ b/dev/module_examples/Example201_PoissonProblem/index.html @@ -41,4 +41,4 @@ end @assert sum((sol_parallel.entries .- sol.entries).^2) ≈ 0.0 -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example202_MixedPoissonProblem/index.html b/dev/module_examples/Example202_MixedPoissonProblem/index.html index e46c79a..7895065 100644 --- a/dev/module_examples/Example202_MixedPoissonProblem/index.html +++ b/dev/module_examples/Example202_MixedPoissonProblem/index.html @@ -57,4 +57,4 @@ return sol, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example203_PoissonProblemDG/index.html b/dev/module_examples/Example203_PoissonProblemDG/index.html index 729e3ce..14014ba 100644 --- a/dev/module_examples/Example203_PoissonProblemDG/index.html +++ b/dev/module_examples/Example203_PoissonProblemDG/index.html @@ -109,4 +109,4 @@ end end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example204_LaplaceEVProblem/index.html b/dev/module_examples/Example204_LaplaceEVProblem/index.html index 888234e..0b93e94 100644 --- a/dev/module_examples/Example204_LaplaceEVProblem/index.html +++ b/dev/module_examples/Example204_LaplaceEVProblem/index.html @@ -48,4 +48,4 @@ return u, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example205_HeatEquation/index.html b/dev/module_examples/Example205_HeatEquation/index.html index d88a935..fc2dd0f 100644 --- a/dev/module_examples/Example205_HeatEquation/index.html +++ b/dev/module_examples/Example205_HeatEquation/index.html @@ -68,4 +68,4 @@ return sol, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example206_CoupledSubGridProblems/index.html b/dev/module_examples/Example206_CoupledSubGridProblems/index.html index 5599c7d..487c28f 100644 --- a/dev/module_examples/Example206_CoupledSubGridProblems/index.html +++ b/dev/module_examples/Example206_CoupledSubGridProblems/index.html @@ -82,4 +82,4 @@ end -end #module

This page was generated using Literate.jl.

+end #module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example207_AdvectionUpwindDG/index.html b/dev/module_examples/Example207_AdvectionUpwindDG/index.html index d7ab690..9efd92f 100644 --- a/dev/module_examples/Example207_AdvectionUpwindDG/index.html +++ b/dev/module_examples/Example207_AdvectionUpwindDG/index.html @@ -140,4 +140,4 @@ simplexgrid(builder, maxvolume = 1) end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example210_LshapeAdaptivePoissonProblem/index.html b/dev/module_examples/Example210_LshapeAdaptivePoissonProblem/index.html index 2e6434a..b942070 100644 --- a/dev/module_examples/Example210_LshapeAdaptivePoissonProblem/index.html +++ b/dev/module_examples/Example210_LshapeAdaptivePoissonProblem/index.html @@ -158,4 +158,4 @@ return sol, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example211_LshapeAdaptiveEQPoissonProblem/index.html b/dev/module_examples/Example211_LshapeAdaptiveEQPoissonProblem/index.html index b562fb1..4825501 100644 --- a/dev/module_examples/Example211_LshapeAdaptiveEQPoissonProblem/index.html +++ b/dev/module_examples/Example211_LshapeAdaptiveEQPoissonProblem/index.html @@ -325,4 +325,4 @@ end end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example220_ReactionConvectionDiffusion/index.html b/dev/module_examples/Example220_ReactionConvectionDiffusion/index.html index 5c2fffa..9964a1e 100644 --- a/dev/module_examples/Example220_ReactionConvectionDiffusion/index.html +++ b/dev/module_examples/Example220_ReactionConvectionDiffusion/index.html @@ -113,4 +113,4 @@ return Results, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example225_ObstacleProblem/index.html b/dev/module_examples/Example225_ObstacleProblem/index.html index 85a01ef..91242fd 100644 --- a/dev/module_examples/Example225_ObstacleProblem/index.html +++ b/dev/module_examples/Example225_ObstacleProblem/index.html @@ -47,4 +47,4 @@ return sol, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example226_Thermoforming/index.html b/dev/module_examples/Example226_Thermoforming/index.html index c89f716..0fbf3f4 100644 --- a/dev/module_examples/Example226_Thermoforming/index.html +++ b/dev/module_examples/Example226_Thermoforming/index.html @@ -126,4 +126,4 @@ return sol, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example230_NonlinearElasticity/index.html b/dev/module_examples/Example230_NonlinearElasticity/index.html index 334c0ff..02fa0cd 100644 --- a/dev/module_examples/Example230_NonlinearElasticity/index.html +++ b/dev/module_examples/Example230_NonlinearElasticity/index.html @@ -141,4 +141,4 @@ return xgrid end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example235_StokesIteratedPenalty/index.html b/dev/module_examples/Example235_StokesIteratedPenalty/index.html index a11f6ba..9e67b89 100644 --- a/dev/module_examples/Example235_StokesIteratedPenalty/index.html +++ b/dev/module_examples/Example235_StokesIteratedPenalty/index.html @@ -67,4 +67,4 @@ return sol, plt end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example240_SVRTEnrichment/index.html b/dev/module_examples/Example240_SVRTEnrichment/index.html index de68c57..24e00b6 100644 --- a/dev/module_examples/Example240_SVRTEnrichment/index.html +++ b/dev/module_examples/Example240_SVRTEnrichment/index.html @@ -415,4 +415,4 @@ return F, DD_RR end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example245_NSEFlowAroundCylinder/index.html b/dev/module_examples/Example245_NSEFlowAroundCylinder/index.html index 9888fa3..4704c59 100644 --- a/dev/module_examples/Example245_NSEFlowAroundCylinder/index.html +++ b/dev/module_examples/Example245_NSEFlowAroundCylinder/index.html @@ -207,4 +207,4 @@ simplexgrid(builder, maxvolume = 16 * maxvol, unsuitable = unsuitable) end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example250_NSELidDrivenCavity/index.html b/dev/module_examples/Example250_NSELidDrivenCavity/index.html index 08fee55..5e44807 100644 --- a/dev/module_examples/Example250_NSELidDrivenCavity/index.html +++ b/dev/module_examples/Example250_NSELidDrivenCavity/index.html @@ -97,4 +97,4 @@ return sol, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example252_NSEPlanarLatticeFlow/index.html b/dev/module_examples/Example252_NSEPlanarLatticeFlow/index.html index dfb62c7..f5c1e96 100644 --- a/dev/module_examples/Example252_NSEPlanarLatticeFlow/index.html +++ b/dev/module_examples/Example252_NSEPlanarLatticeFlow/index.html @@ -96,4 +96,4 @@ return L2errorU, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example260_AxisymmetricNavierStokesProblem/index.html b/dev/module_examples/Example260_AxisymmetricNavierStokesProblem/index.html index 6ea87ab..caf66d2 100644 --- a/dev/module_examples/Example260_AxisymmetricNavierStokesProblem/index.html +++ b/dev/module_examples/Example260_AxisymmetricNavierStokesProblem/index.html @@ -108,4 +108,4 @@ return [div_error, L2error], plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example265_FlowTransport/index.html b/dev/module_examples/Example265_FlowTransport/index.html index a77e47b..0ea7f3d 100644 --- a/dev/module_examples/Example265_FlowTransport/index.html +++ b/dev/module_examples/Example265_FlowTransport/index.html @@ -181,4 +181,4 @@ end end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example270_NaturalConvectionProblem/index.html b/dev/module_examples/Example270_NaturalConvectionProblem/index.html index 7382872..98cc627 100644 --- a/dev/module_examples/Example270_NaturalConvectionProblem/index.html +++ b/dev/module_examples/Example270_NaturalConvectionProblem/index.html @@ -109,4 +109,4 @@ return Nu, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example275_OptimalControlStokes/index.html b/dev/module_examples/Example275_OptimalControlStokes/index.html index 1156f07..c3b89e7 100644 --- a/dev/module_examples/Example275_OptimalControlStokes/index.html +++ b/dev/module_examples/Example275_OptimalControlStokes/index.html @@ -90,4 +90,4 @@ return sol, plt end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example280_CompressibleStokes/index.html b/dev/module_examples/Example280_CompressibleStokes/index.html index 35124b5..dc9bab7 100644 --- a/dev/module_examples/Example280_CompressibleStokes/index.html +++ b/dev/module_examples/Example280_CompressibleStokes/index.html @@ -274,4 +274,4 @@ return ϱ_eval, g_eval[2], f == 0 ? nothing : f_eval[2], u_eval[2], ∇u_eval[2] end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example282_IncompressibleMHD/index.html b/dev/module_examples/Example282_IncompressibleMHD/index.html index 89cd27a..90c09ea 100644 --- a/dev/module_examples/Example282_IncompressibleMHD/index.html +++ b/dev/module_examples/Example282_IncompressibleMHD/index.html @@ -97,4 +97,4 @@ return sol, plt end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example284_LevelSetMethod/index.html b/dev/module_examples/Example284_LevelSetMethod/index.html index fec33f2..5eac947 100644 --- a/dev/module_examples/Example284_LevelSetMethod/index.html +++ b/dev/module_examples/Example284_LevelSetMethod/index.html @@ -89,4 +89,4 @@ return sol, plt end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example285_CahnHilliard/index.html b/dev/module_examples/Example285_CahnHilliard/index.html index 2d630a3..f2ddbd9 100644 --- a/dev/module_examples/Example285_CahnHilliard/index.html +++ b/dev/module_examples/Example285_CahnHilliard/index.html @@ -106,4 +106,4 @@ return sol, plt end -end

This page was generated using Literate.jl.

+end

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example290_PoroElasticity/index.html b/dev/module_examples/Example290_PoroElasticity/index.html index 1f441ce..0dbd598 100644 --- a/dev/module_examples/Example290_PoroElasticity/index.html +++ b/dev/module_examples/Example290_PoroElasticity/index.html @@ -181,4 +181,4 @@ return L2errorU, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example301_PoissonProblem/index.html b/dev/module_examples/Example301_PoissonProblem/index.html index 743c1e0..068dd07 100644 --- a/dev/module_examples/Example301_PoissonProblem/index.html +++ b/dev/module_examples/Example301_PoissonProblem/index.html @@ -33,4 +33,4 @@ return sol, plt end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example310_DivFreeBasis/index.html b/dev/module_examples/Example310_DivFreeBasis/index.html index 8f910fa..d634787 100644 --- a/dev/module_examples/Example310_DivFreeBasis/index.html +++ b/dev/module_examples/Example310_DivFreeBasis/index.html @@ -167,4 +167,4 @@ return findall(==(true), markededges) end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/Example330_HyperElasticity/index.html b/dev/module_examples/Example330_HyperElasticity/index.html index 5df03a6..6f92d23 100644 --- a/dev/module_examples/Example330_HyperElasticity/index.html +++ b/dev/module_examples/Example330_HyperElasticity/index.html @@ -124,4 +124,4 @@ simplexgrid(builder; maxvolume = maxvolume) end -end # module

This page was generated using Literate.jl.

+end # module

This page was generated using Literate.jl.

diff --git a/dev/module_examples/example204.png b/dev/module_examples/example204.png index 6ab7447..76e33d8 100644 Binary files a/dev/module_examples/example204.png and b/dev/module_examples/example204.png differ diff --git a/dev/nonlinearoperator/index.html b/dev/nonlinearoperator/index.html index f249caf..7736fd5 100644 --- a/dev/nonlinearoperator/index.html +++ b/dev/nonlinearoperator/index.html @@ -4,7 +4,7 @@ oa_test::Array{<:Tuple{Union{Unknown,Int}, DataType},1}, oa_args::Array{<:Tuple{Union{Unknown,Int}, DataType},1} = oa_test; jacobian = nothing, - kwargs...)

Generates a nonlinear form for the specified kernel function, test function operators, and argument operators evaluations. Operator evaluations are tuples that pair an unknown identifier or integer with a FunctionOperator. The header of the kernel functions needs to be conform to the interface

kernel!(result, input, qpinfo)

where qpinfo allows to access information at the current quadrature point.

During assembly the Newton update is computed via local jacobians of the kernel which are calculated by automatic differentiation or by the user-provided jacobian function with interface

jacobian!(jac, input_args, params)

Keyword arguments:

source

Example - NSE convection operator

For the Navier–Stokes equations, we need a kernel function for the nonlinear convection term

\[\begin{equation} + kwargs...)

Generates a nonlinear form for the specified kernel function, test function operators, and argument operators evaluations. Operator evaluations are tuples that pair an unknown identifier or integer with a FunctionOperator. The header of the kernel functions needs to be conform to the interface

kernel!(result, input, qpinfo)

where qpinfo allows to access information at the current quadrature point.

During assembly the Newton update is computed via local jacobians of the kernel which are calculated by automatic differentiation or by the user-provided jacobian function with interface

jacobian!(jac, input_args, params)

Keyword arguments:

source

Example - NSE convection operator

For the Navier–Stokes equations, we need a kernel function for the nonlinear convection term

\[\begin{equation} (v,u\cdot\nabla u) = (v,\nabla u^T u) \end{equation}\]

In 2D the input (as specified below) will contain the two components of $u=(u_1,u_2)'$ and the four components of the gradient $\nabla u = \begin{pmatrix} u_{11} & u_{12} \\ u_{21} & u_{22}\end{pmatrix}$ in order, i.e. $(u_1,u_2,u_{11},u_{12},u_{21},u_{22})$. As the convection term is tested with $v$, the ouptut vector $o$ only has to contain what should be tested with each component of $v$, i.e.

\[\begin{equation} A_\text{local} = (v_1,v_2)^T(o_1,o_2) = @@ -58,4 +58,4 @@ F(x) = \sum_{T \in \mathcal{T}} \lvert T \rvert \sum_{x_{qp}} A(L_1u_h(x)(x_{qp})) \cdot L_2v_h(x_{qp}) w_{qp} & = 0 \quad \text{in } \Omega \end{aligned}\]

Now, by linearity of everything involved other than $A$, we can evaluate the jacobian by

\[\begin{aligned} D_xF(x) = \sum_{T \in \mathcal{T}} \lvert T \rvert \sum_{x_{qp}} DA(L_1 u_h(x)(x_{qp})) \cdot L_2 v_h(x_{qp}) w_{qp} & = 0 \quad \text{in } \Omega -\end{aligned}\]

Hence, assembly only requires to evaluate the low-dimensional jacobians $DA \in \mathbb{R}^{m \times n}$ of $A$ at $L_1 u_h(x)(x_{qp})$. These jacobians are computed by automatic differentiation via ForwardDiff.jl (or via the user-given jacobian function). If $m$ and $n$ are a little larger, e.g. when more operator evaluations $L_1$ and $L_2$ or more unknowns are involved, there is the option to use sparse_jacobians (using the sparsity detection of Symbolics.jl).

+\end{aligned}\]

Hence, assembly only requires to evaluate the low-dimensional jacobians $DA \in \mathbb{R}^{m \times n}$ of $A$ at $L_1 u_h(x)(x_{qp})$. These jacobians are computed by automatic differentiation via ForwardDiff.jl (or via the user-given jacobian function). If $m$ and $n$ are a little larger, e.g. when more operator evaluations $L_1$ and $L_2$ or more unknowns are involved, there is the option to use sparse_jacobians (using the sparsity detection of Symbolics.jl).

diff --git a/dev/objects.inv b/dev/objects.inv index 1c588d7..fc65b76 100644 Binary files a/dev/objects.inv and b/dev/objects.inv differ diff --git a/dev/package_index/index.html b/dev/package_index/index.html index ee7c679..f6dd51c 100644 --- a/dev/package_index/index.html +++ b/dev/package_index/index.html @@ -1,2 +1,2 @@ -Index · ExtendableFEM.jl
+Index · ExtendableFEM.jl
diff --git a/dev/parallel_assembly/index.html b/dev/parallel_assembly/index.html index 38215f6..b0029cf 100644 --- a/dev/parallel_assembly/index.html +++ b/dev/parallel_assembly/index.html @@ -1,2 +1,2 @@ -Parallel Assembly · ExtendableFEM.jl

Parallel Assembly

Within the solve call, all operators will be assembled according to their configured parameters. When 'parallel = true' is used (not available yet for all DG operators), the operators will be assembled in parallel based on the color partitions within the grid. Hence, the computational grid must provide these partitions, see Documentation of ExtendableGrids.jl on Partitioning for details. Also the sparse system matrix needs to be able to work on different partitions in parallel. Once, the grid has partitions, the solver automatically uses a suitable constructor for the system matrix (MTExtendableSparseMatrixCSC from ExtendableSparse.jl).

Note

DG operators that assemble along cell faces need the option 'edges = true' in the partition call for the grid partitioning, otherwise assembly will be still sequentially.

+Parallel Assembly · ExtendableFEM.jl

Parallel Assembly

Within the solve call, all operators will be assembled according to their configured parameters. When 'parallel = true' is used (not available yet for all DG operators), the operators will be assembled in parallel based on the color partitions within the grid. Hence, the computational grid must provide these partitions, see Documentation of ExtendableGrids.jl on Partitioning for details. Also the sparse system matrix needs to be able to work on different partitions in parallel. Once, the grid has partitions, the solver automatically uses a suitable constructor for the system matrix (MTExtendableSparseMatrixCSC from ExtendableSparse.jl).

Note

DG operators that assemble along cell faces need the option 'edges = true' in the partition call for the grid partitioning, otherwise assembly will be still sequentially.

diff --git a/dev/pdesolvers/index.html b/dev/pdesolvers/index.html index d6787c2..8760d8b 100644 --- a/dev/pdesolvers/index.html +++ b/dev/pdesolvers/index.html @@ -4,15 +4,15 @@ [FES::Union{<:FESpace,Vector{<:FESpace}}], SC = nothing; unknowns = PD.unknowns, - kwargs...)

Returns a solution of the PDE as an FEVector for the provided FESpace(s) FES (to be used to discretised the unknowns of the PDEs). If no FES is provided an initial FEVector (see keyword init) must be provided (which is used to built the FES).

This function extends the CommonSolve.solve interface and the PDEDescription takes the role of the ProblemType and FES takes the role of the SolverType.

Keyword arguments:

Depending on the detected/configured nonlinearities the whole system is either solved directly in one step or via a fixed-point iteration.

source
Note

The type of fixed-point algorithm depends on the discretisation of the nonlinearities. If all of them are assembled as a NonlinearOperator, this will result in a Newton scheme (which can be somewhat costumized via the keywords arguments like damping). If all nonlinearities are linearized by LinearOperator and BilinearOperator, this will result in other types of fixed-point iterations.

Solve (iterating subproblems)

If the problem can be solved by iterating over subproblems this can be achieved as well. For that each subproblem must be configured separately via a SolverConfiguration (allowing different tolerances and keyword arguments for each subproblem solve). A SolverConfiguration can be constructed with this constructor:

ExtendableFEM.SolverConfigurationType
function iterate_until_stationarity(
+	kwargs...)

Returns a solution of the PDE as an FEVector for the provided FESpace(s) FES (to be used to discretised the unknowns of the PDEs). If no FES is provided an initial FEVector (see keyword init) must be provided (which is used to built the FES).

This function extends the CommonSolve.solve interface and the PDEDescription takes the role of the ProblemType and FES takes the role of the SolverType.

Keyword arguments:

  • abstol: abstol for linear solver (if iterative). Default: 1.0e-11

  • check_matrix: check matrix for symmetry and positive definiteness and largest/smallest eigenvalues. Default: false

  • constant_matrix: matrix is constant (skips reassembly and refactorization in solver). Default: false

  • constant_rhs: right-hand side is constant (skips reassembly). Default: false

  • damping: amount of damping, value should be between in (0,1). Default: 0

  • inactive: inactive unknowns (are made available in assembly, but not updated in solve). Default: ExtendableFEM.Unknown[]

  • init: initial solution (also used to save the new solution). Default: nothing

  • initialized: linear system in solver configuration is already assembled (turns true after first solve). Default: false

  • is_linear: linear problem (avoid reassembly of nonlinear operators to check residual). Default: ''auto''

  • maxiterations: maximal number of nonlinear iterations/linear solves. Default: 10

  • method_linear: any solver or custom LinearSolveFunction compatible with LinearSolve.jl (default = UMFPACKFactorization()). Default: LinearSolve.UMFPACKFactorization(true, true)

  • plot: plot all solved unknowns with a (very rough but fast) unicode plot. Default: false

  • precon_linear: function that computes preconditioner for method_linear incase an iterative solver is chosen. Default: nothing

  • reltol: reltol for linear solver (if iterative). Default: 1.0e-11

  • restrict_dofs: array of dofs for each unknown that should be solved (default: all dofs). Default: Any[]

  • return_config: solver returns solver configuration (including A and b of last iteration). Default: false

  • show_config: show configuration at the beginning of solve. Default: false

  • show_matrix: show system matrix after assembly. Default: false

  • spy: show unicode spy plot of system matrix during solve. Default: false

  • symmetrize: make system matrix symmetric (replace by (A+A')/2). Default: false

  • symmetrize_structure: make the system sparse matrix structurally symmetric (e.g. if [j,k] is also [k,j] must be set, all diagonal entries must be set). Default: false

  • target_residual: stop if the absolute (nonlinear) residual is smaller than this number. Default: 1.0e-10

  • time: current time to be used in all time-dependent operators. Default: 0.0

  • verbosity: verbosity level. Default: 0

Depending on the detected/configured nonlinearities the whole system is either solved directly in one step or via a fixed-point iteration.

source
Note

The type of fixed-point algorithm depends on the discretisation of the nonlinearities. If all of them are assembled as a NonlinearOperator, this will result in a Newton scheme (which can be somewhat costumized via the keywords arguments like damping). If all nonlinearities are linearized by LinearOperator and BilinearOperator, this will result in other types of fixed-point iterations.

Solve (iterating subproblems)

If the problem can be solved by iterating over subproblems this can be achieved as well. For that each subproblem must be configured separately via a SolverConfiguration (allowing different tolerances and keyword arguments for each subproblem solve). A SolverConfiguration can be constructed with this constructor:

ExtendableFEM.SolverConfigurationType
function iterate_until_stationarity(
 	SolverConfiguration(Problem::ProblemDescription
 	[FES::Union{<:FESpace, Vector{<:FESpace}}];
 	init = nothing,
 	unknowns = Problem.unknowns,
-	kwargs...)

Returns a solver configuration for the ProblemDescription that can be passed to the solve function. Here, FES are the FESpaces that should be used to discretize the selected unknowns. If no FES is provided an initial FEVector (see keyword init) must be provided (which is used to built the FES).

Keyword arguments:

  • abstol: abstol for linear solver (if iterative). Default: 1.0e-11

  • check_matrix: check matrix for symmetry and positive definiteness and largest/smallest eigenvalues. Default: false

  • constant_matrix: matrix is constant (skips reassembly and refactorization in solver). Default: false

  • constant_rhs: right-hand side is constant (skips reassembly). Default: false

  • damping: amount of damping, value should be between in (0,1). Default: 0

  • inactive: inactive unknowns (are made available in assembly, but not updated in solve). Default: ExtendableFEM.Unknown[]

  • init: initial solution (also used to save the new solution). Default: nothing

  • initialized: linear system in solver configuration is already assembled (turns true after first solve). Default: false

  • is_linear: linear problem (avoid reassembly of nonlinear operators to check residual). Default: ''auto''

  • maxiterations: maximal number of nonlinear iterations/linear solves. Default: 10

  • method_linear: any solver or custom LinearSolveFunction compatible with LinearSolve.jl (default = UMFPACKFactorization()). Default: LinearSolve.UMFPACKFactorization(true, true)

  • plot: plot all solved unknowns with a (very rough but fast) unicode plot. Default: false

  • precon_linear: function that computes preconditioner for method_linear incase an iterative solver is chosen. Default: nothing

  • reltol: reltol for linear solver (if iterative). Default: 1.0e-11

  • restrict_dofs: array of dofs for each unknown that should be solved (default: all dofs). Default: Any[]

  • return_config: solver returns solver configuration (including A and b of last iteration). Default: false

  • show_config: show configuration at the beginning of solve. Default: false

  • show_matrix: show system matrix after assembly. Default: false

  • spy: show unicode spy plot of system matrix during solve. Default: false

  • symmetrize: make system matrix symmetric (replace by (A+A')/2). Default: false

  • symmetrize_structure: make the system sparse matrix structurally symmetric (e.g. if [j,k] is also [k,j] must be set, all diagonal entries must be set). Default: false

  • target_residual: stop if the absolute (nonlinear) residual is smaller than this number. Default: 1.0e-10

  • time: current time to be used in all time-dependent operators. Default: 0.0

  • verbosity: verbosity level. Default: 0

source

If each subproblem has a SolverConfiguration the fixed-point iteration can be triggered with this function:

ExtendableFEM.iterate_until_stationarityFunction
function iterate_until_stationarity(
+	kwargs...)

Returns a solver configuration for the ProblemDescription that can be passed to the solve function. Here, FES are the FESpaces that should be used to discretize the selected unknowns. If no FES is provided an initial FEVector (see keyword init) must be provided (which is used to built the FES).

Keyword arguments:

  • abstol: abstol for linear solver (if iterative). Default: 1.0e-11

  • check_matrix: check matrix for symmetry and positive definiteness and largest/smallest eigenvalues. Default: false

  • constant_matrix: matrix is constant (skips reassembly and refactorization in solver). Default: false

  • constant_rhs: right-hand side is constant (skips reassembly). Default: false

  • damping: amount of damping, value should be between in (0,1). Default: 0

  • inactive: inactive unknowns (are made available in assembly, but not updated in solve). Default: ExtendableFEM.Unknown[]

  • init: initial solution (also used to save the new solution). Default: nothing

  • initialized: linear system in solver configuration is already assembled (turns true after first solve). Default: false

  • is_linear: linear problem (avoid reassembly of nonlinear operators to check residual). Default: ''auto''

  • maxiterations: maximal number of nonlinear iterations/linear solves. Default: 10

  • method_linear: any solver or custom LinearSolveFunction compatible with LinearSolve.jl (default = UMFPACKFactorization()). Default: LinearSolve.UMFPACKFactorization(true, true)

  • plot: plot all solved unknowns with a (very rough but fast) unicode plot. Default: false

  • precon_linear: function that computes preconditioner for method_linear incase an iterative solver is chosen. Default: nothing

  • reltol: reltol for linear solver (if iterative). Default: 1.0e-11

  • restrict_dofs: array of dofs for each unknown that should be solved (default: all dofs). Default: Any[]

  • return_config: solver returns solver configuration (including A and b of last iteration). Default: false

  • show_config: show configuration at the beginning of solve. Default: false

  • show_matrix: show system matrix after assembly. Default: false

  • spy: show unicode spy plot of system matrix during solve. Default: false

  • symmetrize: make system matrix symmetric (replace by (A+A')/2). Default: false

  • symmetrize_structure: make the system sparse matrix structurally symmetric (e.g. if [j,k] is also [k,j] must be set, all diagonal entries must be set). Default: false

  • target_residual: stop if the absolute (nonlinear) residual is smaller than this number. Default: 1.0e-10

  • time: current time to be used in all time-dependent operators. Default: 0.0

  • verbosity: verbosity level. Default: 0

source

If each subproblem has a SolverConfiguration the fixed-point iteration can be triggered with this function:

ExtendableFEM.iterate_until_stationarityFunction
function iterate_until_stationarity(
 	SCs::Array{<:SolverConfiguration, 1},
 	FES = nothing;
 	maxsteps = 1000,
 	init = nothing,
 	unknowns = [SC.PD.unknowns for SC in SCs],
-	kwargs...)

Iterates consecutively over all SolverConfigurations (each contains the ProblemDescription of the corressponding subproblem) until the residuals of all subproblems are below their tolerances and returns the solution of the combined unknowns of all subproblems. The additional argument maxsteps limits the number of these iterations If an initial vector init is provided it should contain all unknowns of the subproblems.

Using the SolverConfiguration instead of the ProblemDescription in the first argument allows to use different kwargs for each subproblem. The SolverConfiguration for each subproblem can be generated by

SolverConfiguration(PD::ProblemDescription; init = sol, kwargs...)

with the usual keyword arguments.

source
+ kwargs...)

Iterates consecutively over all SolverConfigurations (each contains the ProblemDescription of the corressponding subproblem) until the residuals of all subproblems are below their tolerances and returns the solution of the combined unknowns of all subproblems. The additional argument maxsteps limits the number of these iterations If an initial vector init is provided it should contain all unknowns of the subproblems.

Using the SolverConfiguration instead of the ProblemDescription in the first argument allows to use different kwargs for each subproblem. The SolverConfiguration for each subproblem can be generated by

SolverConfiguration(PD::ProblemDescription; init = sol, kwargs...)

with the usual keyword arguments.

source diff --git a/dev/pdesolvers_dt/index.html b/dev/pdesolvers_dt/index.html index b81d9d9..9f7c286 100644 --- a/dev/pdesolvers_dt/index.html +++ b/dev/pdesolvers_dt/index.html @@ -6,13 +6,13 @@ FES, tspan; mass_matrix = nothing) - kwargs...)

Reframes the ProblemDescription inside the SolverConfiguration into an ODEProblem, for DifferentialEquations.jl where tspan is the desired time interval.

If no mass matrix is provided the standard mass matrix for the respective finite element space(s) for all unknowns is assembled.

Additional keyword arguments:

source
ExtendableFEM.eval_jacobian!Method

Provides the jacobi matrix calculation function for DifferentialEquations.jl/ODEProblem.

source
ExtendableFEM.eval_rhs!Method

Provides the rhs function for DifferentialEquations.jl/ODEProblem.

source
ExtendableFEM.generate_ODEProblemMethod
function generate_ODEProblem(
+	kwargs...)

Reframes the ProblemDescription inside the SolverConfiguration into an ODEProblem, for DifferentialEquations.jl where tspan is the desired time interval.

If no mass matrix is provided the standard mass matrix for the respective finite element space(s) for all unknowns is assembled.

Additional keyword arguments:

  • constant_matrix: matrix is constant (skips reassembly and refactorization in solver). Default: false

  • constant_rhs: right-hand side is constant (skips reassembly). Default: false

  • init: initial solution (otherwise starts with a zero vector). Default: nothing

  • initialized: linear system in solver configuration is already assembled (turns true after first assembly). Default: false

  • sametol: tolerance to identify two solution vectors to be identical (and to skip reassemblies called by DifferentialEquations.jl). Default: 1.0e-15

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.eval_jacobian!Method

Provides the jacobi matrix calculation function for DifferentialEquations.jl/ODEProblem.

source
ExtendableFEM.eval_rhs!Method

Provides the rhs function for DifferentialEquations.jl/ODEProblem.

source
ExtendableFEM.generate_ODEProblemMethod
function generate_ODEProblem(
 	SC::SolverConfiguration,
 	tspan;
 	mass_matrix = nothing)
-	kwargs...)

Reframes the ProblemDescription inside the SolverConfiguration into a SciMLBase.ODEProblem, for DifferentialEquations.jl where tspan is the desired time interval.

If no mass matrix is provided the standard mass matrix for the respective finite element space(s) for all unknowns is assembled.

Keyword arguments:

  • constant_matrix: matrix is constant (skips reassembly and refactorization in solver). Default: false

  • constant_rhs: right-hand side is constant (skips reassembly). Default: false

  • init: initial solution (otherwise starts with a zero vector). Default: nothing

  • initialized: linear system in solver configuration is already assembled (turns true after first assembly). Default: false

  • sametol: tolerance to identify two solution vectors to be identical (and to skip reassemblies called by DifferentialEquations.jl). Default: 1.0e-15

  • verbosity: verbosity level. Default: 0

source
ExtendableFEM.jac_prototypeMethod

Provides the system matrix as prototype for the jacobian.

source
Note

The solvers of DifferentialEquations should be run with the autodiff=false option as it is currently not possible to differentiate the right-hand side of the generated ODEProblem with respect to time.

Example : 2D Heat equation

The following ProblemDescription yields the space discretisation of the heat equation (including homogeneous boundary conditions and equivalent to the Poisson equation).

PD = ProblemDescription("Heat Equation")
+	kwargs...)

Reframes the ProblemDescription inside the SolverConfiguration into a SciMLBase.ODEProblem, for DifferentialEquations.jl where tspan is the desired time interval.

If no mass matrix is provided the standard mass matrix for the respective finite element space(s) for all unknowns is assembled.

Keyword arguments:

source
ExtendableFEM.jac_prototypeMethod

Provides the system matrix as prototype for the jacobian.

source
Note

The solvers of DifferentialEquations should be run with the autodiff=false option as it is currently not possible to differentiate the right-hand side of the generated ODEProblem with respect to time.

Example : 2D Heat equation

The following ProblemDescription yields the space discretisation of the heat equation (including homogeneous boundary conditions and equivalent to the Poisson equation).

PD = ProblemDescription("Heat Equation")
 u = Unknown("u"; name = "temperature")
 assign_unknown!(PD, u)
 assign_operator!(PD, BilinearOperator([grad(u)]; store = true, kwargs...))
 assign_operator!(PD, HomogeneousBoundaryData(u))

Given a finite element space FES and an initial FEVector sol for the unknown, the ODEProblem for some time interval (0,T) can be generated and solved via

prob = generate_ODEProblem(PD, FES, (0, T); init = sol)
-DifferentialEquations.solve(prob, Rosenbrock23(autodiff = false), dt = 1e-3, dtmin = 1e-6, adaptive = true)
+DifferentialEquations.solve(prob, Rosenbrock23(autodiff = false), dt = 1e-3, dtmin = 1e-6, adaptive = true) diff --git a/dev/postprocessing/index.html b/dev/postprocessing/index.html index a4edaf7..96c24de 100644 --- a/dev/postprocessing/index.html +++ b/dev/postprocessing/index.html @@ -1,2 +1,2 @@ -Other packages · ExtendableFEM.jl

Other packages

A lot of functionality is already provided by the bases packages, e.g.:

  • ExtendableGrids.jl offers an interface to WriteVTK.jl which can be used, e.g. in combination with nodevalues interpolations or (piecewise constant) item integrator results. There is also the CellFinder that can be used to find the right cell for a certain point of the domain.
  • ExtendableFEMBase.jl offers a PointEvaluator and a SegmentIntegrator to evaluate solutions at arbitrary points of the domain or integrating along 1D line intersections with the cells of the triangulation. It also provides some basic unicode plots.
  • GridVisualize.jl provides grid and scalar piecewise linear function plotting for various plotting backends on simplicial grids in one, two or three space dimensions. The main supported backends are PyPlot, GLMakie and PlutoVista.
+Other packages · ExtendableFEM.jl

Other packages

A lot of functionality is already provided by the bases packages, e.g.:

  • ExtendableGrids.jl offers an interface to WriteVTK.jl which can be used, e.g. in combination with nodevalues interpolations or (piecewise constant) item integrator results. There is also the CellFinder that can be used to find the right cell for a certain point of the domain.
  • ExtendableFEMBase.jl offers a PointEvaluator and a SegmentIntegrator to evaluate solutions at arbitrary points of the domain or integrating along 1D line intersections with the cells of the triangulation. It also provides some basic unicode plots.
  • GridVisualize.jl provides grid and scalar piecewise linear function plotting for various plotting backends on simplicial grids in one, two or three space dimensions. The main supported backends are PyPlot, GLMakie and PlutoVista.
diff --git a/dev/problemdescription/index.html b/dev/problemdescription/index.html index 7c69b85..6b2053f 100644 --- a/dev/problemdescription/index.html +++ b/dev/problemdescription/index.html @@ -1,6 +1,6 @@ -Problem Description · ExtendableFEM.jl

Problem Description

Central object is the ProblemDescription which is given as a weak form of your problem and usually does not need any information on the discretisation at this point (but of course can depend on region numbers).

ExtendableFEM.ProblemDescriptionType
struct ProblemDescription

Structure holding data for a problem description with the following fields:

  • name::String: The name of the problem used for printout messages. Default: "My Problem"
  • unknowns::Vector{Unknown}: A vector of Unknowns that are involved in the problem.
  • operators::Vector{AbstractOperator}: A vector of operators that are involved in the problem.
source

Constructors and assign functions

ExtendableFEM.assign_operator!Method
assign_operator!(PD::ProblemDescription, o::AbstractOperator)

Assigns the AbstractOperator o to the ProblemDescription PD and returns its position in the operators array of the ProblemDescription.

source
ExtendableFEM.assign_unknown!Method
assign_unknown!(PD::ProblemDescription, u::Unknown)

Assigns the Unknown u to the ProblemDescription PD and returns its position in the unknowns array of the ProblemDescription.

source
ExtendableFEM.replace_operator!Method
replace_operator!(PD::ProblemDescription, j::Int, o::AbstractOperator)

Replaces the j-th operator of the ProblemDescription PD by the new operator o. Here, j is the position in operator array returned by the assign_operator! function. Nothing is returned (as the new operator gets position j).

source

Unknowns

An Unknown is an identifies that encodes a physical quantity in the ProblemDescription.

ExtendableFEM.UnknownType
struct Unknown

Structure holding information for an unknwon with the following fields:

  • name::String: The name of the unknown used for printout messages.
  • identifier::Any: The identifier of the unknown used for assignments to operators.
  • parameters::Dict{Symbol, Any}: Further properties of the unknown can be stored in a Dict, see constructor.
source
ExtendableFEM.UnknownMethod
function Unknown(
+Problem Description · ExtendableFEM.jl

Problem Description

Central object is the ProblemDescription which is given as a weak form of your problem and usually does not need any information on the discretisation at this point (but of course can depend on region numbers).

ExtendableFEM.ProblemDescriptionType
struct ProblemDescription

Structure holding data for a problem description with the following fields:

  • name::String: The name of the problem used for printout messages. Default: "My Problem"
  • unknowns::Vector{Unknown}: A vector of Unknowns that are involved in the problem.
  • operators::Vector{AbstractOperator}: A vector of operators that are involved in the problem.
source

Constructors and assign functions

ExtendableFEM.assign_operator!Method
assign_operator!(PD::ProblemDescription, o::AbstractOperator)

Assigns the AbstractOperator o to the ProblemDescription PD and returns its position in the operators array of the ProblemDescription.

source
ExtendableFEM.assign_unknown!Method
assign_unknown!(PD::ProblemDescription, u::Unknown)

Assigns the Unknown u to the ProblemDescription PD and returns its position in the unknowns array of the ProblemDescription.

source
ExtendableFEM.replace_operator!Method
replace_operator!(PD::ProblemDescription, j::Int, o::AbstractOperator)

Replaces the j-th operator of the ProblemDescription PD by the new operator o. Here, j is the position in operator array returned by the assign_operator! function. Nothing is returned (as the new operator gets position j).

source

Unknowns

An Unknown is an identifies that encodes a physical quantity in the ProblemDescription.

ExtendableFEM.UnknownType
struct Unknown

Structure holding information for an unknwon with the following fields:

  • name::String: The name of the unknown used for printout messages.
  • identifier::Any: The identifier of the unknown used for assignments to operators.
  • parameters::Dict{Symbol, Any}: Further properties of the unknown can be stored in a Dict, see constructor.
source
ExtendableFEM.UnknownMethod
function Unknown(
 	u::String;
 	identifier = Symbol(u),
 	name = u,
-	kwargs...)

Generates and returns an Unknown with the specified name, identifier and other traits.

Example: BilinearOperator([grad(1)], [grad(1)]; kwargs...) generates a weak Laplace operator.

Keyword arguments:

  • algebraic_constraint: is this unknown an algebraic constraint?. Default: nothing

  • dimension: dimension of the unknown. Default: nothing

  • symbol_ansatz: symbol for ansatz functions of this unknown in printouts. Default: nothing

  • symbol_test: symbol for test functions of this unknown in printouts. Default: nothing

source

Operators

Operator is a quite general concept and is everything that makes modifications to the system matrix, hence classical representations of weak discretisations of differential operators, penalisations for boundary conditions or constraints, or stabilisation terms.

Types of operators

The three most important operator classes are:

  • NonlinearOperator (e.g. the convection term in a Navier-Stokes problem)
  • BilinearOperator (e.g. the Laplacian in a Poisson problem)
  • LinearOperator (e.g. the right-hand side in a Poisson or Navier-Stokes problem)

To assing boundary conditions or global constraints there are three possibilities:

  • InterpolateBoundaryData
  • HomogeneousData
  • FixDofs
  • CombineDofs

Entities and Regions

Each operator assembles on certain entities of the mesh, the default is a cell-wise assembly. Most operators have the entities kwarg to changes that. Restrictions to subsets of the entities can be made via the regions kwarg.

EntitiesDescription
AT_NODESinterpolate at vertices of the mesh (only for H1-conforming FEM)
ON_CELLSassemble/interpolate on the cells of the mesh
ON_FACESassemble/interpolate on all faces of the mesh
ON_IFACESassemble/interpolate on the interior faces of the mesh
ON_BFACESassemble/interpolate on the boundary faces of the mesh
ON_EDGES (*)assemble/interpolate on all edges of the mesh (in 3D)
ON_BEDGES (*)assemble/interpolate on the boundary edges of the mesh (in 3D)
Note

(*) = only reasonable in 3D and still experimental, might have some issues

+ kwargs...)

Generates and returns an Unknown with the specified name, identifier and other traits.

Example: BilinearOperator([grad(1)], [grad(1)]; kwargs...) generates a weak Laplace operator.

Keyword arguments:

  • algebraic_constraint: is this unknown an algebraic constraint?. Default: nothing

  • dimension: dimension of the unknown. Default: nothing

  • symbol_ansatz: symbol for ansatz functions of this unknown in printouts. Default: nothing

  • symbol_test: symbol for test functions of this unknown in printouts. Default: nothing

source

Operators

Operator is a quite general concept and is everything that makes modifications to the system matrix, hence classical representations of weak discretisations of differential operators, penalisations for boundary conditions or constraints, or stabilisation terms.

Types of operators

The three most important operator classes are:

  • NonlinearOperator (e.g. the convection term in a Navier-Stokes problem)
  • BilinearOperator (e.g. the Laplacian in a Poisson problem)
  • LinearOperator (e.g. the right-hand side in a Poisson or Navier-Stokes problem)

To assing boundary conditions or global constraints there are three possibilities:

  • InterpolateBoundaryData
  • HomogeneousData
  • FixDofs
  • CombineDofs

Entities and Regions

Each operator assembles on certain entities of the mesh, the default is a cell-wise assembly. Most operators have the entities kwarg to changes that. Restrictions to subsets of the entities can be made via the regions kwarg.

EntitiesDescription
AT_NODESinterpolate at vertices of the mesh (only for H1-conforming FEM)
ON_CELLSassemble/interpolate on the cells of the mesh
ON_FACESassemble/interpolate on all faces of the mesh
ON_IFACESassemble/interpolate on the interior faces of the mesh
ON_BFACESassemble/interpolate on the boundary faces of the mesh
ON_EDGES (*)assemble/interpolate on all edges of the mesh (in 3D)
ON_BEDGES (*)assemble/interpolate on the boundary edges of the mesh (in 3D)
Note

(*) = only reasonable in 3D and still experimental, might have some issues

diff --git a/dev/tensordescription/index.html b/dev/tensordescription/index.html index 292883d..e4c418c 100644 --- a/dev/tensordescription/index.html +++ b/dev/tensordescription/index.html @@ -1,2 +1,2 @@ -Tensor Description · ExtendableFEM.jl

Tensor Description

To be able to construct reshaped views of the test functions and their derivates, we can describe the shape of the view through a TensorDescription{R,D} where R is the rank of the tensor and D is the dimension or extent of the tensor in each of the R directions. That means a real valued R-tensor is an element of $\underbrace{\mathbb{R}^D\times\cdots\times\mathbb{R}^D}_{R \text{ times}}$. Specifically, we can identify the following mathematical objects with tensors of different ranks:

math. objectR-Tensor
scalar $\in\mathbb{R}$0-Tensor
vector $\in\mathbb{R}^D$1-Tensor
matrix $\in\mathbb{R}^D\times\mathbb{R}^D$2-Tensor

For finite elements, D usually matches the spatial dimension of the problem we want to solve, i.e. D=2 for 2D and D=3 for 3D.

Tensor Types

ExtendableFEM.TDScalarType
TDScalar{D}

Specification for a 0-tensor or scalar, i.e. TensorDescription{0,D}, to improve readability.

Note that in this case D has no greater effect and is only provided to have a matching interface between all the specifications.

source
ExtendableFEM.TDVectorType
TDVector{D}

Specification for a 1-tensor or vector, i.e. TensorDescription{1,D}, to improve readability.

source
ExtendableFEM.TDMatrixType
TDMatrix{D}

Specification for a 2-tensor or matrix, i.e. TensorDescription{2,D}, to improve readability.

source

Reshaped views

ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{2,dim})

Returns a view of input[i:i+dim^2-1] reshaped as a (dim,dim) matrix.

source
ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{3,dim})

Returns a view of input[i:i+dim^3-1] reshaped as a (dim,dim,dim) 3-tensor.

source
ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{4,dim})

Returns a view of input[i:i+dim^4-1] reshaped as (dim,dim,dim,dim) 4-tensor.

source
ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{0,dim})

Returns a view of input[i] reshaped as a vector of length 1.

source
ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{1,dim})

Returns a view of input[i:i+dim-1] reshaped as a vector of length dim.

source
ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{rank,dim})

Returns a view of input[i] and subsequent entries, reshaped as a rank-tensor of dimension dim.

Note that this general implementation is a fallback for rank>4 that will likely produce allocations and slow assembly times if used in a kernel function.

source

Which tensor for which unknown?

For an unknown variable u of tensor rank r a derivative of order n has rank r+n, i.e. the hessian (n=2) of a scalar unknown (rank 0) and the gradient (n=1) of a vector valued (rank 1) variable are both matrices (rank 2).

For a more comprehensive list see the following table

derivative orderscalar-valuedvector-valuedmatrix-valued
0 (value/id)TDScalar(D)TDVector(D)TDMatrix(D)
1 (grad)TDVector(D)TDMatrix(D)TDRank3(D)
2 (hessian)TDMatrix(D)TDRank3(D)TDRank4(D)
3TDRank3(D)TDRank4(D)TensorDescription(5,D)
4TDRank4(D)TensorDescription(5,D)TensorDescription(6,D)
$\vdots$$\vdots$$\vdots$$\vdots$

Helpers

ExtendableFEM.tmul!Function
function tmul!(y,A,x,α=1.0,β=0.0)

Combined inplace matrix-vector multiply-add $A^T x α + y β$. The result is stored in y by overwriting it. Note that y must not be aliased with either A or x.

source
function tmul!(y::AbstractVector{T}, A::AbstractMatrix{T}, x::AbstractVector{T}, α=1.0, β=0.0) where {T<:AbstractFloat}

Overload of the generic function for types supported by LinearAlgebra.BLAS.gemv! to avoid slow run times for large inputs.

source
+Tensor Description · ExtendableFEM.jl

Tensor Description

To be able to construct reshaped views of the test functions and their derivates, we can describe the shape of the view through a TensorDescription{R,D} where R is the rank of the tensor and D is the dimension or extent of the tensor in each of the R directions. That means a real valued R-tensor is an element of $\underbrace{\mathbb{R}^D\times\cdots\times\mathbb{R}^D}_{R \text{ times}}$. Specifically, we can identify the following mathematical objects with tensors of different ranks:

math. objectR-Tensor
scalar $\in\mathbb{R}$0-Tensor
vector $\in\mathbb{R}^D$1-Tensor
matrix $\in\mathbb{R}^D\times\mathbb{R}^D$2-Tensor

For finite elements, D usually matches the spatial dimension of the problem we want to solve, i.e. D=2 for 2D and D=3 for 3D.

Tensor Types

ExtendableFEM.TDScalarType
TDScalar{D}

Specification for a 0-tensor or scalar, i.e. TensorDescription{0,D}, to improve readability.

Note that in this case D has no greater effect and is only provided to have a matching interface between all the specifications.

source
ExtendableFEM.TDVectorType
TDVector{D}

Specification for a 1-tensor or vector, i.e. TensorDescription{1,D}, to improve readability.

source
ExtendableFEM.TDMatrixType
TDMatrix{D}

Specification for a 2-tensor or matrix, i.e. TensorDescription{2,D}, to improve readability.

source

Reshaped views

ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{2,dim})

Returns a view of input[i:i+dim^2-1] reshaped as a (dim,dim) matrix.

source
ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{3,dim})

Returns a view of input[i:i+dim^3-1] reshaped as a (dim,dim,dim) 3-tensor.

source
ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{4,dim})

Returns a view of input[i:i+dim^4-1] reshaped as (dim,dim,dim,dim) 4-tensor.

source
ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{0,dim})

Returns a view of input[i] reshaped as a vector of length 1.

source
ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{1,dim})

Returns a view of input[i:i+dim-1] reshaped as a vector of length dim.

source
ExtendableFEM.tensor_viewMethod
function tensor_view(input,i::Int,::TensorDescription{rank,dim})

Returns a view of input[i] and subsequent entries, reshaped as a rank-tensor of dimension dim.

Note that this general implementation is a fallback for rank>4 that will likely produce allocations and slow assembly times if used in a kernel function.

source

Which tensor for which unknown?

For an unknown variable u of tensor rank r a derivative of order n has rank r+n, i.e. the hessian (n=2) of a scalar unknown (rank 0) and the gradient (n=1) of a vector valued (rank 1) variable are both matrices (rank 2).

For a more comprehensive list see the following table

derivative orderscalar-valuedvector-valuedmatrix-valued
0 (value/id)TDScalar(D)TDVector(D)TDMatrix(D)
1 (grad)TDVector(D)TDMatrix(D)TDRank3(D)
2 (hessian)TDMatrix(D)TDRank3(D)TDRank4(D)
3TDRank3(D)TDRank4(D)TensorDescription(5,D)
4TDRank4(D)TensorDescription(5,D)TensorDescription(6,D)
$\vdots$$\vdots$$\vdots$$\vdots$

Helpers

ExtendableFEM.tmul!Function
function tmul!(y,A,x,α=1.0,β=0.0)

Combined inplace matrix-vector multiply-add $A^T x α + y β$. The result is stored in y by overwriting it. Note that y must not be aliased with either A or x.

source
function tmul!(y::AbstractVector{T}, A::AbstractMatrix{T}, x::AbstractVector{T}, α=1.0, β=0.0) where {T<:AbstractFloat}

Overload of the generic function for types supported by LinearAlgebra.BLAS.gemv! to avoid slow run times for large inputs.

source