Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
juddmehr committed Sep 26, 2024
1 parent 135fbab commit 75afebf
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 23 deletions.
16 changes: 8 additions & 8 deletions docs/src/DuctAPE/advanced_usage/option.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ As part of the pre-process, an elliptic grid defining the wake geometry is solve
For this solve there currently two options:

- [SLOR](@ref "DuctAPE.SLORGridSolverOptions"): DFDC grid solver
- [SLOR+Newton](@ref "DuctAPE.GridSolverOptions")
- [Default](@ref "DuctAPE.GridSolverOptions"): Default method compatible with ImplicitAD

The SLOR (successive line over relaxation) is the method employed by DFDC, and can be used by itself, or as a preconditioner to a Newton solve (using NLsolve.jl).
The SLOR (successive line over relaxation) is the method employed by DFDC.

Selection of solver and solver settings follows the same pattern as with the quadrature settings, in that the user must pass the appropriate `GridSolverOptionsType` into the `set_options` call.

Expand All @@ -80,16 +80,16 @@ For the SLOR method alone, the type is
DuctAPE.SLORGridSolverOptions
```

And for the SLOR+Newton method, the type is
And for the default method compatible with ImplicitAD, the type is
```@docs; canonical=false
DuctAPE.GridSolverOptions
```

As an example, this is the input that would be required to use the SLOR+Newton method with an absolute convergence tolerance of 1e-12, and also including the quadrature settings from above:
As an example, this is the input that would be required to use the default method with an absolute convergence tolerance of 1e-10, and also including the quadrature settings from above:

```julia
# define wake grid solver settings
wake_solve_options = DuctAPE.GridSolverOptions(; atol=1e-12)
wake_solve_options = DuctAPE.GridSolverOptions(; atol=1e-10)

# set all options
options = DuctAPE.set_options(;
Expand All @@ -106,14 +106,15 @@ There are two general types of solvers available in DuctAPE, the first is very s
The other type is for external solvers that converge an alternate residual that is default in DuctAPE.
The various solver options include:
- [CSOR](@ref "DuctAPE.CSORSolverOptions"): the DFDC solver
- [ModCSOR](@ref "DuctAPE.ModCSORSolverOptions"): modified DFDC solver for ImplicitAD compatibility
- [FixedPoint.jl](@ref "DuctAPE.FixedPointOptions")
- [SpeedMapping.jl](@ref "DuctAPE.SpeedMappingOptions")
- [MINPACK.jl](@ref "DuctAPE.MinpackOptions")
- [SIAMFANLEquations.jl](@ref "DuctAPE.SIAMFANLEOptions")
- [NLsolve.jl](@ref "DuctAPE.NLsolveOptions")
- [SimpleNonlinearSolve.jl](@ref "DuctAPE.NonlinearSolveOptions")

Note that the CSOR, FixedPoint.jl, and SpeedMapping.jl are all different fixed-point iteration solvers, MINPACK.jl and SIAMFANLEquations.jl are primarily quasi-newton solvers, and NLsolve.jl and SimpleNonlinearSolve.jl have various solver options.
Note that the CSOR, ModCSOR, FixedPoint.jl, and SpeedMapping.jl are all different fixed-point iteration solvers, MINPACK.jl and SIAMFANLEquations.jl are primarily quasi-newton solvers, and NLsolve.jl and SimpleNonlinearSolve.jl have various solver options.

DuctAPE also has some poly-algorithm solvers that employ more than one solver.
The [Chain Solver](@ref "DuctAPE.ChainSolverOptions") option is the default which starts with a fixed-point iteration, and if it doesn't converge, moves on to a quasi-, then full Newton solver until either convergence is reached, or no convergence is found.
Expand Down Expand Up @@ -154,10 +155,9 @@ Here is an example for setting options with the CSOR solver.
nop = 3

options = DuctAPE.set_options(;
solver_options=DuctAPE.CSORSolverOptions(;
solver_options=DuctAPE.ModCSORSolverOptions(;
converged=fill(false, (1, nop)), # need a convergence flag for each operating point
iterations=zeros(Int, (1, nop)), # need a iteration count for each operating point
Vconv=ones(nop), # in this case, we need a reference velocity for each operating point
),
write_outputs=fill(false, nop), # we need to know which of the operating point outputs to write
outfile=fill("", nop), # we need to include names, even if they won't be used.
Expand Down
4 changes: 3 additions & 1 deletion docs/src/DuctAPE/api/private_prelims.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ DuctAPE.ConvergenceType
DuctAPE.Relative
DuctAPE.Absolute
DuctAPE.SolverOptionsType
DuctAPE.InternalSolverOptions
DuctAPE.InternalPolyAlgorithmOptions
DuctAPE.ExternalSolverOptions
DuctAPE.PolyAlgorithmOptions
DuctAPE.ExternalPolyAlgorithmOptions
DuctAPE.GridSolverOptionsType
DuctAPE.IntegrationMethod
```
Expand Down
29 changes: 24 additions & 5 deletions docs/src/DuctAPE/api/private_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,36 @@ DuctAPE.process
DuctAPE.solve
```

#### Residuals
#### Solvers
##### ModCSOR
```@docs
DuctAPE.mod_COR_solver
DuctAPE.relax_Gamr_mod!
DuctAPE.relax_gamw_mod!
DuctAPE.update_states!
```

##### CSOR
```@docs
DuctAPE.CSOR_residual!
DuctAPE.compute_CSOR_residual!
DuctAPE.relax_Gamr!
DuctAPE.relax_gamw!
DuctAPE.apply_relaxation_schedule
DuctAPE.update_CSOR_residual_values!
DuctAPE.check_CSOR_convergence!
DuctAPE.relax_Gamr!
DuctAPE.relax_gamw!
```

#### Residuals

##### ModCSOR
```@docs
DuctAPE.mod_CSOR_residual!
DuctAPE.estimate_CSOR_states!
```

##### CSOR
```@docs
DuctAPE.CSOR_residual!
DuctAPE.compute_CSOR_residual!
```

##### External Solvers
Expand Down
1 change: 1 addition & 0 deletions docs/src/DuctAPE/api/public_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ DuctAPE.SIAMFANLEOptions
DuctAPE.SpeedMappingOptions
DuctAPE.FixedPointOptions
DuctAPE.CSORSolverOptions
DuctAPE.ModCSORSolverOptions
```
## Preprocess

Expand Down
6 changes: 5 additions & 1 deletion src/process/residuals/CSORresidual.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,8 @@ Apply relaxed step to Gamr.
- `Gamr::Array{Float}` : Array of rotor circulations (columns = rotors, rows = blade elements), updated in place
- `delta_prev_mat::Array{Float}` : Array of previous iteration's differences in circulation values, updated in place
- `delta_mat::Array{Float}` : Array of current iteration's differences in circulation values
- `maxBGamr::Array{Float}` : stores value of maximum B*Gamr for each rotor
- `maxdeltaBGamr::Array{Float}` : stores value of maximum change in B*Gamr for each rotor
- `B::Vector{Float}` : number of blades on each rotor
- `nrf::Float=0.4` : nominal relaxation factor
- `bt1::Float=0.2` : backtrack factor 1
Expand Down Expand Up @@ -528,7 +530,9 @@ Apply relaxed step to gamw.
- `gamw::Array{Float}` : Array of rotor circulations (columns = rotors, rows = blade elements), updated in place
- `delta_prev_mat::Array{Float}` : Array of previous iteration's differences in circulation values, updated in place
- `delta_mat::Array{Float}` : Array of current iteration's differences in circulation values
- `B::Vector{Float}` : number of blades on each rotor
- `maxdeltagamw::Array{Float}` : Single element array that gets updated with the new maximum change in gamw.
# Keyword Arguments:
- `nrf::Float=0.4` : nominal relaxation factor
- `bt1::Float=0.2` : backtrack factor 1
- `bt2::Float=0.6` : backtrack factor 2
Expand Down
2 changes: 1 addition & 1 deletion src/process/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ function solve(
end

function solve(
solver_options::Union{ChainSolverOptions,CSORChainSolverOptions},
solver_options::ChainSolverOptions,
sensitivity_parameters,
const_cache;
initial_guess=nothing,
Expand Down
14 changes: 7 additions & 7 deletions src/process/solvers/modCSORsolver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function mod_COR_solver(
end

"""
relax_Gamr!(
relax_Gamr_mod!(
Gamr,
r_Gamr_current,
r_Gamr_previous,
Expand Down Expand Up @@ -103,7 +103,7 @@ Apply relaxed step to Gamr.
- `pf1::Float=0.4` : press forward factor 1
- `pf2::Float=0.5` : press forward factor 2
"""
function relax_Gamr!(
function relax_Gamr_mod!(
Gamr, B, r_Gamr_current, r_Gamr_previous; nrf=0.4, bt1=0.2, bt2=0.6, pf1=0.4, pf2=0.5
)

Expand Down Expand Up @@ -183,7 +183,7 @@ function relax_Gamr!(
end

"""
relax_gamw!(gamw, r_gamw_current, r_gamw_previous; nrf=0.4, btw=0.6, pfw=1.2)
relax_gamw_mod!(gamw, r_gamw_current, r_gamw_previous; nrf=0.4, btw=0.6, pfw=1.2)
Apply relaxed step to gamw.
Expand All @@ -199,7 +199,7 @@ Apply relaxed step to gamw.
- `pf1::Float=0.4` : press forward factor 1
- `pf2::Float=0.5` : press forward factor 2
"""
function relax_gamw!(gamw, r_gamw_current, r_gamw_previous; nrf=0.4, btw=0.6, pfw=1.2)
function relax_gamw_mod!(gamw, r_gamw_current, r_gamw_previous; nrf=0.4, btw=0.6, pfw=1.2)

# initilize
TF = eltype(gamw)
Expand Down Expand Up @@ -245,7 +245,7 @@ function update_states!(states, r_current, r_previous, B, relaxation_parameters,

# println("before: ", Gamr)
# - relax Gamr values - #
relax_Gamr!(
relax_Gamr_mod!(
Gamr,
B,
r_Gamr_current,
Expand All @@ -259,7 +259,7 @@ function update_states!(states, r_current, r_previous, B, relaxation_parameters,
# println("after: ", Gamr)

# relax gamw values
relax_gamw!(
relax_gamw_mod!(
gamw,
r_gamw_current,
r_gamw_previous;
Expand All @@ -269,7 +269,7 @@ function update_states!(states, r_current, r_previous, B, relaxation_parameters,
)

# - relax sigr values using same method as Gamr - #
relax_Gamr!(
relax_Gamr_mod!(
sigr,
B,
r_sigr_current,
Expand Down
1 change: 1 addition & 0 deletions src/utilities/options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ Note that the defaults match DFDC with the exception of the relaxation schedule,
- `convergence_type::ConvergenceType = Relative()` : dispatch for relative or absolute convergence criteria.
- `Vconv::AbstractArray{Float} = [1.0]` : velocity used in relative convergence criteria (should be set to Vref).
- `converged::AbstractArray{Bool} = [false]` : flag to track if convergence took place.
- `iterations::AbstractArray{Int} = [0]` : iteration counter
"""
@kwdef struct CSORSolverOptions{TB,TC<:ConvergenceType,TF,TI,TS} <: InternalSolverOptions
# Defaults are DFDC hard-coded values
Expand Down

0 comments on commit 75afebf

Please sign in to comment.