Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gridap/Gridap.jl into raviart-thomas
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Dec 15, 2024
2 parents e2e6b95 + 17a4f2e commit 8c77d23
Show file tree
Hide file tree
Showing 32 changed files with 896 additions and 177 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
- uses: codecov/codecov-action@v5
with:
file: lcov.info
verbose: true
Expand Down
20 changes: 20 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Added AMR-related methods `mark` and `estimate` to `Adaptivity` module. Implemented Dorfler marking strategy. Since PR[#1063](https://github.com/gridap/Gridap.jl/pull/1063).

### Changed

- Low level optimisations to reduce allocations. `AffineMap` renamed to `AffineField`. New `AffineMap <: Map`, doing the same as `AffineField` without struct allocation. New `ConstantMap <: Map`, doing the same as `ConstantField` without struct allocation. Since PR[#1043](https://github.com/gridap/Gridap.jl/pull/1043).

## [0.18.8] - 2024-12-2

### Added

- Added get_dof_value_type for FESpacesWithLinearConstraints. Since PR[#1062](https://github.com/gridap/Gridap.jl/pull/1062).
- Added Xiao-Gimbutas quadratures for simplices. Since PR[#1058](https://github.com/gridap/Gridap.jl/pull/1058).
- Small improvements of the documentation of `Gridap.TensorValues`. Since PR[#1051](https://github.com/gridap/Gridap.jl/pull/1051).

### Fixed

- Fixed #974, an error when weak form is real but unknown vector is complex. Since PR[#1050](https://github.com/gridap/Gridap.jl/pull/1050).
- Fixed issue where barycentric refinement rule in 3D would not produce oriented meshes. Since PR[#1055](https://github.com/gridap/Gridap.jl/pull/1055).

### Changed

- Optimized MonomialBasis low-level functions. Since PR[#1059](https://github.com/gridap/Gridap.jl/pull/1059).

## [0.18.7] - 2024-10-8

### Added
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Gridap"
uuid = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e"
authors = ["Santiago Badia <[email protected]>", "Francesc Verdugo <[email protected]>", "Alberto F. Martin <[email protected]>"]
version = "0.18.7"
version = "0.18.8"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
1 change: 1 addition & 0 deletions benchmark/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e"
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1 change: 1 addition & 0 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ end
const SUITE = BenchmarkGroup()

@include_bm SUITE "bm_assembly"
@include_bm SUITE "bm_monomial_basis"
190 changes: 190 additions & 0 deletions benchmark/bm/bm_monomial_basis.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
module bm_monomial_basis

using PkgBenchmark, BenchmarkTools
using Gridap
using Gridap.Polynomials
using Gridap.TensorValues
using StaticArrays

################################################
# src/Polynomials/MonomialBasis.jl: _set_value_!
################################################

gradient_type = Gridap.Fields.gradient_type

_set_value! = Gridap.Polynomials._set_value!

function set_value_driver(f,T,D,x,n)
k = 1
s = one(T)
for i in 1:n
k = f(x,s,k)
end
end

function set_value_benchmarkable(D, T, V, n)
C = num_indep_components(V)
x = zeros(V,n*C)
return @benchmarkable set_value_driver($_set_value!,$T,$D,$x,$n)
end

##################################################
# src/Polynomials/ModalC0Bases.jl: _set_value_mc0!
##################################################

_set_value_mc0! = Gridap.Polynomials._set_value_mc0!

function set_value_mc0_driver(f,T,D,x,n)
k = 1
s = one(T)
for i in 1:n
k = f(x,s,k,2)
end
end

function set_value_mc0_benchmarkable(D, T, V, n)
C = num_indep_components(V)
x = zeros(V,2*n*C)
return @benchmarkable set_value_mc0_driver($_set_value_mc0!,$T,$D,$x,$n)
end

###################################################
# src/Polynomials/MonomialBasis.jl: _set_gradient!
###################################################

 _set_gradient! = Gridap.Polynomials. _set_gradient!

function set_gradient_driver(f,T,D,V,x,n)
k = 1
s = VectorValue{D,T}(ntuple(_->one(T),D))
for i in 1:n
k = f(x,s,k,V)
end
end

function set_gradient_benchmarkable(D, T, V, n)
C = num_indep_components(V)
G = gradient_type(V, zero(Point{D,T}))
x = zeros(G,n*C);
return @benchmarkable set_gradient_driver($_set_gradient!,$T,$D,$V,$x,$n)
end

#####################################################
# src/Polynomials/ModalC0Bases.jl: _set_gradient_mc0!
#####################################################

 _set_gradient_mc0! = Gridap.Polynomials. _set_gradient_mc0!

function set_gradient_mc0_driver(f,T,D,V,x,n)
k = 1
s = VectorValue{D,T}(ntuple(_->one(T),D))
for i in 1:n
k = f(x,s,k,1,V)
end
end

function set_gradient_mc0_benchmarkable(D, T, V, n)
C = num_indep_components(V)
G = gradient_type(V, zero(Point{D,T}))
x = zeros(G,n*C);
return @benchmarkable set_gradient_mc0_driver($_set_gradient_mc0!,$T,$D,$V,$x,$n)
end

#################################################
# src/Polynomials/MonomialBasis.jl: _evaluate_1d!
#################################################

_evaluate_1d! = Gridap.Polynomials._evaluate_1d!

function evaluate_1d_driver(f,order,D,v,x_vec)
for x in x_vec
f(v,x,order,D)
end
end

function evaluate_1d_benchmarkable(D, T, V, n)
n = Integer(n/50)
order = num_indep_components(V)
v = zeros(D,order+1);
x = rand(MVector{n,T})
return @benchmarkable evaluate_1d_driver($_evaluate_1d!,$order,$D,$v,$x)
end

################################################
# src/Polynomials/MonomialBasis.jl:_gradient_1d!
################################################

_gradient_1d! = Gridap.Polynomials._gradient_1d!

function gradient_1d_driver(f,order,D,v,x_vec)
for x in x_vec
f(v,x,order,D)
end
end

function gradient_1d_benchmarkable(D, T, V, n)
n = Integer(n/10)
order = num_indep_components(V)
v = zeros(D,order+1);
x = rand(MVector{n,T})
return @benchmarkable gradient_1d_driver($_gradient_1d!,$order,$D,$v,$x)
end

################################################
# src/Polynomials/MonomialBasis.jl:_hessian_1d!
################################################

_hessian_1d! = Gridap.Polynomials._hessian_1d!

function hessian_1d_driver(f,order,D,v,x_vec)
for x in x_vec
f(v,x,order,D)
end
end

function hessian_1d_benchmarkable(D, T, V, n)
n = Integer(n/10)
order = num_indep_components(V)
v = zeros(D,order+1);
x = rand(MVector{n,T})
return @benchmarkable hessian_1d_driver($_hessian_1d!,$order,$D,$v,$x)
end

#####################
# benchmarkable suite
#####################

const SUITE = BenchmarkGroup()

const benchmarkables = (
set_value_benchmarkable,
set_value_mc0_benchmarkable,
set_gradient_benchmarkable,
set_gradient_mc0_benchmarkable,
evaluate_1d_benchmarkable,
gradient_1d_benchmarkable,
hessian_1d_benchmarkable
)

const dims=(1, 2, 3, 5, 8)
const n = 3000
const T = Float64

for benchable in benchmarkables
for D in dims
TV = [
VectorValue{D,T},
TensorValue{D,D,T,D*D},
SymTensorValue{D,T,Integer(D*(D+1)/2)},
SymTracelessTensorValue{D,T,Integer(D*(D+1)/2)}
]

for V in TV
if V == SymTracelessTensorValue{1,T,1} continue end # no dofs
name = "monomial_basis_$(D)D_$(V)_$(benchable)"
SUITE[name] = benchable(D, T, V, n)
end
end
end

end # module
12 changes: 12 additions & 0 deletions docs/src/Adaptivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ The API is given by the following methods:
MacroReferenceFE
```

## Adaptive Mesh Refinement

One of the main uses of mesh refinement is Adaptive Mesh Refinement, where the mesh is refined only in regions of interest.

The typical AMR workflow is the so-called `solve-estimate-mark-refine` loop. Since estimators will generally be problem-dependent, we only aim to provide some generic tools that can be combined by the user:

```@docs
DorflerMarking
mark
estimate
```

## Notes for users

Most of the tools provided by this module are showcased in the tests of the module itself, as well as the following tutorial (coming soon).
Expand Down
Loading

0 comments on commit 8c77d23

Please sign in to comment.