# Adaptive mesh refinement in JuMP

**URL:** <https://discourse.julialang.org/t/adaptive-mesh-refinement-in-jump/81864>\
**Category:** Optimization (Mathematical)\
**Created:** [May 29, 2022, 12:42pm UTC](https://discourse.julialang.org/t/adaptive-mesh-refinement-in-jump/81864 "2022-05-29T12:42:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kieran\_Marray](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kieran_marray/32/35686_2.png) [@Kieran\_Marray](https://discourse.julialang.org/u/Kieran_Marray)\
**Post date:** [May 29, 2022, 12:42pm UTC](https://discourse.julialang.org/t/adaptive-mesh-refinement-in-jump/81864/1 "2022-05-29T12:42:35Z")

</div>

I have a non-linear programming problem similar to the space shuttle problem in the JuMP tutorial [Optimal control for a Space Shuttle reentry trajectory · JuMP](https://jump.dev/JuMP.jl/stable/tutorials/nonlinear/space_shuttle_reentry_trajectory/). I want to implement adaptive mesh refinement to ensure an accurate solution. Does anyone know a relatively easy way to do this in/on top of JuMP?

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [May 29, 2022, 10:21pm UTC](https://discourse.julialang.org/t/adaptive-mesh-refinement-in-jump/81864/2 "2022-05-29T22:21:18Z")

</div>

JuMP doesn’t provide any mechanisms for doing this. You’ll have to code your own models or algorithms.

What you probably need to do is some iterative method, where you solve the problem, look at the solution, and then re-run with an updated mesh based on some metric.

For example, you might want to add more steps at a place where the gradient of the state variables are large. I would guess there’s probably some standard literature on this, but I don’t really know the field.

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [May 30, 2022, 12:01am UTC](https://discourse.julialang.org/t/adaptive-mesh-refinement-in-jump/81864/3 "2022-05-30T00:01:30Z")

</div>

The closest example I know of is [PDENLPModels.jl](https://github.com/JuliaSmoothOptimizers/PDENLPModels.jl), which has a JuMP interface via [NLPModelsJuMP.jl](https://github.com/JuliaSmoothOptimizers/NLPModelsJuMP.jl).  
@tmigot
