Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/apinene.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export apinene

# Isometrization of α-pinene COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
function apinene(args...; n = 400, kwargs...)
function apinene(n :: Int = 400, args...; kwargs...)
T = 36420.0
model = CartesianDiscreteModel((0, T), n)

Expand Down
3 changes: 2 additions & 1 deletion src/bearing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export bearing
# Journal Bearing COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n= 50, 75, 100
function bearing(args...; n = 50, kwargs...)
function bearing(n :: Int = 50, args...; kwargs...)

ϵ = 0.1
b = 10

Expand Down
2 changes: 1 addition & 1 deletion src/burger1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Suggestions:
- FEOperatorFromTerms has only one term. We might consider splitting linear and
nonlinear terms.
"""
function burger1d(args...; n::Int = 512, kwargs...)
function burger1d(n :: Int = 512, args...; kwargs...)

#Domain
domain = (0, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/burger1d_param.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export burger1d_param

function burger1d_param(args...; n = 512, kwargs...)
function burger1d_param(n :: Int = 512, args...; kwargs...)
domain = (0, 1)
partition = n
model = CartesianDiscreteModel(domain, partition)
Expand Down
2 changes: 1 addition & 1 deletion src/catmix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export catmix
# Catalyst Mixing COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n=100, 200, 400
function catmix(args...; n::Int = 100, kwargs...)
function catmix(n :: Int = 100, args...; kwargs...)

#Domain
domain = (0, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/cellincrease.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Mairet, F., & Bayen, T. (2021). The promise of dawn: microalgae photoacclimation

Using a photosynthetic rate proportional to the photosynthetic apparatus mass fraction.
"""
function cellincrease(args...; x0 = [0.6, 0.1], n = 10, T = 7, kwargs...)
function cellincrease(n :: Int = 10, args...; x0 = [0.6, 0.1], T = 7, kwargs...)
kp(x) = 1.01
kr(x) = 2.03

Expand Down
2 changes: 1 addition & 1 deletion src/cellincrease_MichaelisMenten.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Mairet, F., & Bayen, T. (2021). The promise of dawn: microalgae photoacclimation

Using Michaelis-Menten's function for the photosynthetic rate.
"""
function cellincrease_MichaelisMenten(args...; x0 = [0.6, 0.1], n = 10, T = 7, kwargs...)
function cellincrease_MichaelisMenten(n :: Int = 10, args...; x0 = [0.6, 0.1], T = 7, kwargs...)
kp(x) = 1.6
kr(x) = 2.1
K(x) = 140.
Expand Down
2 changes: 1 addition & 1 deletion src/channel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export channel

# Isometrization of Flow in a Channel COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
function channel(args...; n = 400, kwargs...)
function channel(n :: Int = 400, args...; kwargs...)
model = CartesianDiscreteModel((0, 1), n)

labels = get_face_labeling(model)
Expand Down
2 changes: 1 addition & 1 deletion src/controlelasticmembrane1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The force term is h(x_1,x_2) = - sin( ω x_1)sin( ω x_2) with ω = π - 1/8.
In this first case, the bound constraints are constants with
umin(x) = 0.0 and umax(x) = 1.0.
"""
function controlelasticmembrane1(args...; n::Int = 10, kargs...)
function controlelasticmembrane1(n :: Int = 10, args...; kargs...)

#Domain
domain = (-1, 1, -1, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/controlelasticmembrane2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The force term is h(x_1,x_2) = - sin( ω x_1)sin( ω x_2) with ω = π - 1/8.
In this second case, the bound constraints are
umin(x) = x_1+x_2 and umax(x) = x_1^2+x_2^2 applied at the midpoint of the cells.
"""
function controlelasticmembrane2(; n::Int = 10, args...)
function controlelasticmembrane2(n :: Int = 10, args...; kargs...)

# Domain
domain = (-1, 1, -1, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/controlsir.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export controlsir

function controlsir(args...; x0 = [1, 2], n = 10, a = 0.2, b = 0.1, μ = 0.1, T = 1, kwargs...)
function controlsir(n :: Int = 10, args...; x0 = [1, 2], a = 0.2, b = 0.1, μ = 0.1, T = 1, kwargs...)
model = CartesianDiscreteModel((0, T), n)

labels = get_face_labeling(model)
Expand Down
3 changes: 2 additions & 1 deletion src/dirichlet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export dirichlet
# Transition States for the Dirichlet Problem COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n=10, 20, 40
function dirichlet(args...; n = 10, kwargs...)
function dirichlet(n :: Int = 10, args...; kwargs...)

domain = (-1, 1, -1, 1)
model = CartesianDiscreteModel(domain, n)

Expand Down
2 changes: 1 addition & 1 deletion src/dynamicsir.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export dynamicsir

function dynamicsir(args...; x0 = [1, 2], n = 10, T = 1, kwargs...)
function dynamicsir(n :: Int = 10, args...; x0 = [1, 2], T = 1, kwargs...)
model = CartesianDiscreteModel((0, T), n)
labels = get_face_labeling(model)
add_tag_from_tags!(labels, "diri0", [1]) #initial time condition
Expand Down
3 changes: 2 additions & 1 deletion src/gasoil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export gasoil
# Catalytic Cracking of Gas Oil COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n=100, 200, 400
function gasoil(args...; n = 100, kwargs...)
function gasoil(n :: Int = 100, args...; kwargs...)

model = CartesianDiscreteModel((0, 1), n)

valuetype = Float64
Expand Down
3 changes: 2 additions & 1 deletion src/glider.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export glider
# Hang Glider COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n=100, 200, 400
function glider(args...; n = 100, kwargs...)
function glider(n :: Int = 100, args...; kwargs...)

model = CartesianDiscreteModel((0, 1), n)
labels = get_face_labeling(model)
add_tag_from_tags!(labels, "diri0", [1]) #initial time condition
Expand Down
3 changes: 2 additions & 1 deletion src/henon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export henon
# Transition States for the Henon Problem COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n=10, 20, 40
function henon(args...; n = 10, kwargs...)
function henon(n :: Int = 10, args...; kwargs...)

domain = (-1, 1, -1, 1)
model = CartesianDiscreteModel(domain, n)

Expand Down
2 changes: 1 addition & 1 deletion src/ignition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export ignition
# Example 2. IGNITION
# Multilevel Active-Set Trust-Region (MASTR) Method for Bound Constrained Minimization
# Alena Kopaničáková and Rolf Krause
function ignition(args...; n = 3, kwargs...)
function ignition(n :: Int = 3, args...; kwargs...)
# n est la taille de la discrétisation (entier)
domain = (0, 1, 0, 1)
model = CartesianDiscreteModel(domain, (n, n))
Expand Down
2 changes: 1 addition & 1 deletion src/incompressibleNavierStokes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ https://gridap.github.io/Tutorials/stable/pages/t008_inc_navier_stokes/

It has no objective function and no control, just the PDE.
"""
function incompressiblenavierstokes(args...; n = 3, kwargs...)
function incompressiblenavierstokes(n :: Int = 3, args...; kwargs...)
domain = (0, 1, 0, 1)
partition = (n, n)
model = CartesianDiscreteModel(domain, partition)
Expand Down
2 changes: 1 addition & 1 deletion src/inversepoissonproblem2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This example has been used in [Section 9.2](Estrin, R., Friedlander, M. P., Orba
Implementing a smooth exact penalty function for equality-constrained nonlinear optimization.
SIAM Journal on Scientific Computing, 42(3), A1809-A1835.)
"""
function inversepoissonproblem2d(; n::Int = 100)
function inversepoissonproblem2d(n :: Int = 100, args...; kargs...)

#Domain
domain = (-1, 1, -1, 1)
Expand Down
3 changes: 2 additions & 1 deletion src/lane_emden.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export lane_emden
# Transition States for the Lane-Emden Problem COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n=10, 20, 40
function lane_emden(args...; n = 10, kwargs...)
function lane_emden(n :: Int = 10, args...; kwargs...)

domain = (-1, 1, -1, 1)
model = CartesianDiscreteModel(domain, n)

Expand Down
2 changes: 1 addition & 1 deletion src/membrane.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Alena Kopaničáková and Rolf Krause
The solution and original problem is given in
Domorádová, M., & Dostál, Z. (2007). Projector preconditioning for partially bound‐constrained quadratic optimization. Numerical Linear Algebra with Applications, 14(10), 791-806.
"""
function membrane(args...; n = 3, kwargs...)
function membrane(n :: Int = 3, args...; kwargs...)
# n est la taille de la discrétisation (entier)
domain = (0, 1, 0, 1)
model = CartesianDiscreteModel(domain, (n, n))
Expand Down
3 changes: 2 additions & 1 deletion src/methanol.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export methanol
# Methanol to Hydrocarbons COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n=100, 200, 400
function methanol(args...; n = 100, kwargs...)
function methanol(n :: Int = 100, args...; kwargs...)

model = CartesianDiscreteModel((0, 1), n)

valuetype = Float64
Expand Down
3 changes: 2 additions & 1 deletion src/minsurf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export minsurf
# Minimal Surface with Obstacle COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n= 50, 75, 100
function minsurf(args...; n = 50, kwargs...)
function minsurf(n :: Int = 50, args...; kwargs...)

domain = (0, 1, 0, 1)
model = CartesianDiscreteModel(domain, (n, n))
trian = Triangulation(model)
Expand Down
2 changes: 1 addition & 1 deletion src/morebv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export morebv
# Example 3. MOREBV
# Multilevel Active-Set Trust-Region (MASTR) Method for Bound Constrained Minimization
# Alena Kopaničáková and Rolf Krause
function morebv(args...; n = 3, kwargs...)
function morebv(n :: Int = 3, args...; kwargs...)
# n est la taille de la discrétisation (entier)
domain = (0, 1, 0, 1)
model = CartesianDiscreteModel(domain, (n, n))
Expand Down
2 changes: 1 addition & 1 deletion src/penalizedpoisson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The minimizer of this problem is the solution of the Poisson equation:

This example has been used in [Exercice 10.2.4 (p. 308)](G. Allaire, Analyse numérique et optimisation, Les éditions de Polytechnique)
"""
function penalizedpoisson(args...; n = 2^4, kwargs...)
function penalizedpoisson(n :: Int = 2^4, args...; kwargs...)
domain = (0, 1, 0, 1)
partition = (n, n)
model = CartesianDiscreteModel(domain, partition)
Expand Down
2 changes: 1 addition & 1 deletion src/poisson3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ So, the minimal value is expected to be 0.
It is inspired from the 2nd tutorial in Gridap.jl:
https://gridap.github.io/Tutorials/stable/pages/t002_validation/
"""
function poisson3d(; n::Int = 10)
function poisson3d(n :: Int = 10, args...; kwargs...)

#For instance, the following lines build a CartesianDiscreteModel for the unit cube
# (0,1)^3 with n cells per direction
Expand Down
2 changes: 1 addition & 1 deletion src/poisson_with_Neumann_and_Dirichlet.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export poisson_with_Neumann_and_Dirichlet

function poisson_with_Neumann_and_Dirichlet(args...; n::Int = 10, kwargs...)
function poisson_with_Neumann_and_Dirichlet(n :: Int = 10, args...; kwargs...)
#model = DiscreteModelFromFile("https://github.com/gridap/Tutorials/tree/master/models/model.json")
# model = DiscreteModelFromFile("models/model.json")
#writevtk(model,"model")
Expand Down
2 changes: 1 addition & 1 deletion src/poissonboltzman2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The specificity of the problem:
- quadratic objective function;
- nonlinear constraints with AD jacobian;
"""
function poissonboltzman2d(; n::Int = 100)
function poissonboltzman2d(n :: Int = 100, args...; kwargs...)

#Domain
domain = (-1, 1, -1, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/poissonmixed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export poissonmixed
# * |k| = 2
#
###############################################################################
function poissonmixed(args...; n = 3, kwargs...)
function poissonmixed(n :: Int = 3, args...; kwargs...)
domain = (0, 1, 0, 1)
partition = (n, n)
model = CartesianDiscreteModel(domain, partition)
Expand Down
2 changes: 1 addition & 1 deletion src/poissonmixed2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export poissonmixed2
# * |k| = 2
#
###############################################################################
function poissonmixed2(args...; n = 3, kwargs...)
function poissonmixed2(n :: Int = 3, args...; kwargs...)
domain = (0, 1, 0, 1)
partition = (n, n)
model = CartesianDiscreteModel(domain, partition)
Expand Down
2 changes: 1 addition & 1 deletion src/poissonparam.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export poissonparam
# * |k| = 1
#
###############################################################################
function poissonparam(args...; n = 3, kwargs...)
function poissonparam(n :: Int = 3, args...; kwargs...)
domain = (0, 1, 0, 1)
partition = (n, n)
model = CartesianDiscreteModel(domain, partition)
Expand Down
2 changes: 1 addition & 1 deletion src/robot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export robot
# Isometrization of Robot Arm COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n=200, 400, 800
function robot(args...; n = 400, kwargs...)
function robot(n :: Int = 400, args...; kwargs...)
T = 1.0
model = CartesianDiscreteModel((0, T), n)
labels = get_face_labeling(model)
Expand Down
2 changes: 1 addition & 1 deletion src/rocket.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export rocket
# Goddard Rocket COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n=400, 800, 1600
function rocket(args...; n = 400, kwargs...)
function rocket(n :: Int = 400, args...; kwargs...)

model = CartesianDiscreteModel((0, 1), n)
labels = get_face_labeling(model)
Expand Down
2 changes: 1 addition & 1 deletion src/sis.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export sis

function sis(args...; x0 = [1, 2], n = 10, a = 0.2, b = 0.7, T = 1, kwargs...)
function sis(n :: Int = 10, args...; x0 = [1, 2], a = 0.2, b = 0.7, T = 1, kwargs...)
model = CartesianDiscreteModel((0, T), n)
labels = get_face_labeling(model)
add_tag_from_tags!(labels, "diri0", [1]) #initial time condition
Expand Down
2 changes: 1 addition & 1 deletion src/smallestlaplacianeigenvalue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TODO:
- does the 1 work as it is? or should it be put in lcon, ucon?
- it is 1D for now.
"""
function smallestlaplacianeigenvalue(; n::Int = 10, args...)
function smallestlaplacianeigenvalue(n :: Int = 10, args...; kwargs...)

#Domain
domain = (0, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/steering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export steering
# Isometrization of Particle Steering COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
# n=200, 400, 800
function steering(args...; n = 400, kwargs...)
function steering(n :: Int = 400, args...; kwargs...)
T = 1.0
model = CartesianDiscreteModel((0, T), n)
labels = get_face_labeling(model)
Expand Down
2 changes: 1 addition & 1 deletion src/torebrachistochrone.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export torebrachistochrone

function torebrachistochrone(args...; n = 3, kwargs...)
function torebrachistochrone(n :: Int = 3, args...; kwargs...)
# n est la taille de la discrétisation (entier)
# le domain au format (t₀, T)
domain = (0, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/torsion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export torsion

# Elastic-Plastic Torsion COPS Problem v.0.3.1
# https://www.mcs.anl.gov/~more//cops/cops3.pdf
function torsion(args...; n = 3, kwargs...)
function torsion(n :: Int = 3, args...; kwargs...)
# n est la taille de la discrétisation (entier)
# le domain au format (t₀, T)
domain = (0, 1, 0, 1)
Expand Down
20 changes: 9 additions & 11 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ include("utils.jl")

# Test that every problem can be instantiated.
for prob in setdiff(names(PDEOptimizationProblems), [:PDEOptimizationProblems])
@time begin
print(prob)
prob_fn = PDEOptimizationProblems.eval(prob)
nlp = prob_fn(n = 10)
println(" nvar=", nlp.meta.nvar, " ncon=", nlp.meta.ncon)
obj(nlp, nlp.meta.x0)
nlp.meta.ncon != 0 && cons(nlp, nlp.meta.x0)
hess(nlp, nlp.meta.x0, nlp.meta.y0)
# test meta information
meta_sanity(prob)
end
print(prob)
prob_fn = PDEOptimizationProblems.eval(prob)
nlp = prob_fn(10)
println(" nvar=",nlp.meta.nvar," ncon=",nlp.meta.ncon)
obj(nlp, nlp.meta.x0)
nlp.meta.ncon != 0 && cons(nlp, nlp.meta.x0)
hess(nlp, nlp.meta.x0, nlp.meta.y0)
# test meta information
meta_sanity(prob)
end
2 changes: 1 addition & 1 deletion test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function meta_sanity(name)
meta = eval(Meta.parse("PDEOptimizationProblems.$(name)_meta"))
n, m = eval(Meta.parse("PDEOptimizationProblems.get_$(name)_meta($ndef)"))

nlp = eval(Meta.parse("PDEOptimizationProblems.$(name)(n = $ndef)"))
nlp = eval(Meta.parse("PDEOptimizationProblems.$(name)($ndef)"))

@show nlp.meta.name, meta[:name]
if !(name in [:incompressiblenavierstokes])
Expand Down