Skip to content

Commit fb28ea0

Browse files
Finetune docs and namings
1 parent f09da9a commit fb28ea0

7 files changed

Lines changed: 16 additions & 28 deletions

File tree

docs/src/topics/nonlinear-solver.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ A simple linear viscoelastic material model in 1D in weak form is:
6666
\end{aligned}
6767
```
6868

69-
Assuming we have a single 1D element $\Omega = [-1,1]$ with linear ansatz functions and Gauss-Legendre quadrature (i.e. 2 points) the Neumann conditon $\partial_x u(1,t) = 1$ and the Dirichlet condition $u(-1,t) = 0$, then applying a Galerkin semi-discretization yields the following linear DAE in mass matrix form:
69+
Assuming we have a single 1D element $\Omega = [-1,1]$ with linear ansatz functions and Gauss-Legendre quadrature (i.e. 2 points) the Neumann condition $\partial_x u(1,t) = 1$ and the Dirichlet condition $u(-1,t) = 0$, then applying a Galerkin semi-discretization yields the following linear DAE in mass matrix form:
7070

7171
```math
7272
\begin{aligned}

docs/src/topics/operators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Operators
22

3-
## TLDT
3+
## TLDR
44

5-
In Thunderbolt operator are the glue code to connect spatial finite element discretizations with time integration algorithms.
5+
In Thunderbolt ,,operators'' connect (spatial) finite element discretizations and time integration algorithms.
66

77
## More
88

src/modeling/common.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ end
1212

1313
setup_internal_cache(::EmptyInternalModel, ::QuadratureRule, ::SubDofHandler) = EmptyInternalCache()
1414

15-
# function state(model_cache::EmptyInternalCache, geometry_cache, qp::QuadraturePoint, time)
16-
# return EmptyInternal()
17-
# end
1815

1916
abstract type AbstractSourceTerm end
2017

src/modeling/core/element_interface.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ Interface:
88
"""
99
abstract type AbstractVolumetricElementCache end
1010

11-
# setup_element_cache(model, qr, sdh) = setup_element_cache(model, qr, Ferrite.getfieldinterpolation(sdh,1), sdh) # FIXME
12-
1311
@doc raw"""
1412
assemble_element!(Kₑ::AbstractMatrix, cell::CellCache, element_cache::AbstractVolumetricElementCache, time)
1513
Main entry point for bilinear operators
@@ -56,8 +54,6 @@ Interface:
5654
"""
5755
abstract type AbstractSurfaceElementCache end
5856

59-
# setup_boundary_cache(model, qr, sdh) = setup_boundary_cache(model, qr, Ferrite.getfieldinterpolation(sdh,1), sdh) # FIXME
60-
6157
@doc raw"""
6258
assemble_face!(Kₑ::AbstractMatrix, cell::CellCache, face_cache::AbstractSurfaceElementCache, time)
6359
Main entry point for bilinear operators

src/modeling/functions.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,12 @@ function default_initial_condition!(u::AbstractVector, f::QuasiStaticFunction)
108108
for cell in CellIterator(sdh)
109109
for qp in QuadratureIterator(qr)
110110
q = @view uq[offset:(offset+ivsize_per_qp-1)]
111-
default_initial_condition!(q, f.integrator.volume_model.material_model)
111+
default_initial_state!(q, f.integrator.volume_model.material_model)
112112
offset += ivsize_per_qp
113113
end
114114
end
115115
end
116116
end
117117

118-
# TODO fill me
119118
gather_internal_variable_infos(model::QuasiStaticModel) = gather_internal_variable_infos(model.material_model)
120119
gather_internal_variable_infos(model::AbstractMaterialModel) = InternalVariableInfo[]

src/modeling/solid/contraction.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function setup_contraction_model_cache(contraction_model::AbstractRateDependentS
3030
end
3131

3232
# Some defaults
33-
function default_initial_condition!(u::AbstractVector, model::AbstractSteadyStateSarcomereModel)
33+
function default_initial_state!(Q::AbstractVector, model::AbstractSteadyStateSarcomereModel)
3434
return nothing
3535
end
3636
function gather_internal_variable_infos(model::AbstractSteadyStateSarcomereModel)
@@ -75,7 +75,7 @@ num_states(wrapper::CaDrivenInternalSarcomereModel) = num_states(wrapper.model)
7575
compute_λᵃ(state, wrapper::CaDrivenInternalSarcomereModel) = compute_λᵃ(state, wrapper.model)
7676
sarcomere_rhs!(dQ, Q, λ, dλdt, Ca, time, wrapper::CaDrivenInternalSarcomereModel) = sarcomere_rhs!(dQ, Q, λ, dλdt, Ca, time, wrapper.model)
7777
gather_internal_variable_infos(wrapper::CaDrivenInternalSarcomereModel) = gather_internal_variable_infos(wrapper.model)
78-
default_initial_condition!(uq::AbstractVector, wrapper::CaDrivenInternalSarcomereModel) = default_initial_condition!(uq, wrapper.model)
78+
default_initial_state!(Q::AbstractVector, wrapper::CaDrivenInternalSarcomereModel) = default_initial_state!(Q, wrapper.model)
7979

8080
struct TrivialCaDrivenCondensationSarcomereCache{ModelType, ModelCacheType, CalciumCacheType} <: TrivialCondensationMaterialStateCache
8181
model::ModelType
@@ -192,9 +192,12 @@ Base.@kwdef struct RDQ20MFModel{TD} <: AbstractRateDependentSarcomereModel
192192
a_XB::TD = 22.894e3 # kPa
193193
end
194194

195-
function default_initial_condition!(u::AbstractVector, model::RDQ20MFModel)
196-
u[1] = 1.0
197-
u[2:end] .= 0.0
195+
function default_initial_state!(Q::AbstractVector, model::RDQ20MFModel)
196+
# # This should always work fine
197+
# Q[1] = 1.0
198+
# Q[2:end] .= 0.0
199+
# This is the state after one contraction cycle for the default parameters
200+
Q .= [0.7451876573694929, 0.007517009301760875, 0.0010350369178622212, 0.0015046158115571504, 0.007517009301760875, 7.585301667185471e-5, 0.0015046158115571504, 0.0021881177060878326, 0.21148929223807816, 0.0021338710904123333, 0.0029375672075666608, 0.004271067937365375, 0.0021338710904123333, 2.1554465506341194e-5, 0.004271067937365375, 0.0062117927965376855, 0.0015658677556970083, 3.7308812267140636e-5, 0.004255024490691453, 0.00010138135740251573]
198201
end
199202
num_states(model::RDQ20MFModel) = 20
200203

src/solver/time/euler.jl

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,6 @@ mutable struct BackwardEulerStageFunctionWrapper{F,U,T,S, LVH} <: AbstractTimeDi
176176
const lvh::LVH
177177
end
178178

179-
function extract_global_function(f)
180-
return f
181-
end
182-
183-
function extract_local_function(f)
184-
return f
185-
end
186-
187179
# We unpack to dispatch per function class
188180
function setup_solver_cache(wrapper::BackwardEulerStageAnnotation, solver::AbstractNonlinearSolver)
189181
_setup_solver_cache(wrapper, wrapper.f, solver)
@@ -193,6 +185,7 @@ end
193185
@unpack volume_model, face_model = integrator
194186
@unpack local_solver, newton = solver
195187

188+
# TODO add an abstraction layer to autoamte the steps below
196189
singleQsize = local_function_size(f)
197190
local_solver_cache = GenericLocalNonlinearSolverCache(
198191
# Solver parameters
@@ -293,9 +286,9 @@ end
293286
function setup_element_cache(wrapper::AbstractTimeDiscretizationAnnotation{<:QuasiStaticModel}, qr::QuadratureRule, sdh::SubDofHandler)
294287
@assert length(sdh.dh.field_names) == 1 "Support for multiple fields not yet implemented."
295288
field_name = first(sdh.dh.field_names)
296-
ip = Ferrite.getfieldinterpolation(sdh, field_name)
297-
ip_geo = geometric_subdomain_interpolation(sdh)
298-
cv = CellValues(qr, ip, ip_geo)
289+
ip = Ferrite.getfieldinterpolation(sdh, field_name)
290+
ip_geo = geometric_subdomain_interpolation(sdh)
291+
cv = CellValues(qr, ip, ip_geo)
299292
return QuasiStaticElementCache(
300293
wrapper.f.material_model,
301294
setup_coefficient_cache(wrapper.f.material_model, qr, sdh),

0 commit comments

Comments
 (0)