{"id":28452682,"url":"https://github.com/juliasmoothoptimizers/pdenlpmodels.jl","last_synced_at":"2025-06-27T23:31:34.136Z","repository":{"id":38425197,"uuid":"307761645","full_name":"JuliaSmoothOptimizers/PDENLPModels.jl","owner":"JuliaSmoothOptimizers","description":"A NLPModel API for optimization problems with PDE-constraints","archived":false,"fork":false,"pushed_at":"2024-12-14T14:19:49.000Z","size":5546,"stargazers_count":21,"open_issues_count":14,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-27T02:08:08.013Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JuliaSmoothOptimizers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-10-27T16:28:19.000Z","updated_at":"2025-06-26T17:50:51.000Z","dependencies_parsed_at":"2024-01-12T19:50:41.841Z","dependency_job_id":"3a5d5d15-797d-4101-b1a7-bbbec9a658e9","html_url":"https://github.com/JuliaSmoothOptimizers/PDENLPModels.jl","commit_stats":{"total_commits":280,"total_committers":7,"mean_commits":40.0,"dds":0.06785714285714284,"last_synced_commit":"a723cbc00f464bf5efd13f285442efe439fcc6ad"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/JuliaSmoothOptimizers/PDENLPModels.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaSmoothOptimizers%2FPDENLPModels.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaSmoothOptimizers%2FPDENLPModels.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaSmoothOptimizers%2FPDENLPModels.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaSmoothOptimizers%2FPDENLPModels.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuliaSmoothOptimizers","download_url":"https://codeload.github.com/JuliaSmoothOptimizers/PDENLPModels.jl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaSmoothOptimizers%2FPDENLPModels.jl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262351518,"owners_count":23297633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-06T18:12:23.148Z","updated_at":"2025-06-27T23:31:34.117Z","avatar_url":"https://github.com/JuliaSmoothOptimizers.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PDENLPModels\n\n| **Documentation** | **CI** | **Coverage** | **Release** | **DOI** |\n|:-----------------:|:------:|:------------:|:-----------:|:-------:|\n| [![docs-stable][docs-stable-img]][docs-stable-url] [![docs-dev][docs-dev-img]][docs-dev-url] | [![build-ci][build-ci-img]][build-ci-url] | [![codecov][codecov-img]][codecov-url] | [![release][release-img]][release-url] | [![doi][doi-img]][doi-url] |\n\n[docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg\n[docs-stable-url]: https://JuliaSmoothOptimizers.github.io/PDENLPModels.jl/stable\n[docs-dev-img]: https://img.shields.io/badge/docs-dev-purple.svg\n[docs-dev-url]: https://JuliaSmoothOptimizers.github.io/PDENLPModels.jl/dev\n[build-ci-img]: https://github.com/JuliaSmoothOptimizers/PDENLPModels.jl/workflows/CI/badge.svg?branch=main\n[build-ci-url]: https://github.com/JuliaSmoothOptimizers/PDENLPModels.jl/actions\n[codecov-img]: https://codecov.io/gh/JuliaSmoothOptimizers/PDENLPModels.jl/branch/main/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/JuliaSmoothOptimizers/PDENLPModels.jl\n[release-img]: https://img.shields.io/github/v/release/JuliaSmoothOptimizers/PDENLPModels.jl.svg?style=flat-square\n[release-url]: https://github.com/JuliaSmoothOptimizers/PDENLPModels.jl/releases\n[doi-img]: https://joss.theoj.org/papers/10.21105/joss.04736/status.svg\n[doi-url]: https://doi.org/10.21105/joss.04736\n\nPDENLPModels specializes the [NLPModel API](https://github.com/JuliaSmoothOptimizers/NLPModels.jl) to optimization problems with partial differential equations in the constraints. The package relies on [Gridap.jl](https://github.com/gridap/Gridap.jl) for the modeling and the computation of the derivatives. Find tutorials for using Gridap [here](https://github.com/gridap/Tutorials).\n\nWe consider optimization problems of the form: Find functions $(y,u): Y \\times U \\rightarrow ℜⁿ \\times ℜⁿ$ and $κ \\in ℜⁿ$ satisfying\n\n$$\n\\begin{equation}\n   \\begin{array}{cl} \n   \\min_{\\kappa,y,u} \u0026 \\int_\\Omega f(\\kappa,y,u) d\\Omega \\\\ \n   \\text{ s.t. } \u0026 y \\text{ solution of a } PDE(\\kappa,u)=0, \\\\\n   \u0026 lcon \\leq c(\\kappa,y,u) \\leq ucon, \\\\\n   \u0026 lvar \\leq (\\kappa,y,u) \\leq uvar,\\\\\n   \\end{array} \n\\end{equation}\n$$\n\nWe refer to the the repository [PDEOptimizationProblems](https://github.com/tmigot/PDEOptimizationProblems) for examples of problems of different types: calculus of variations, optimal control problem, PDE-constrained problems, and mixed PDE-contrained problems with both function and algebraic unknowns.\n\n## Installation\n\n```\n] add PDENLPModels\n```\nThe current version of PDENLPModels relies on Gridap v0.15.5.\n\n## Example\n\n$$\n\\begin{equation}\n   \\min_{y \\in H^1_0,u \\in H^1} \\frac{1}{2} \\int_{\\Omega} |y(x) - y_d(x)|^2dx + \\frac{\\alpha}{2} \\int_{\\Omega} |u|^2 \\quad \\text{ s.t. } -\\Delta y = u + h,   \\text{ for }    x \\in \\Omega, y = 0 \\text{ for } x \\in \\partial \\Omega,\n\\end{equation}\n$$\n\nwhere $y_d(x) = -x_1^2$, $h(x) = 1$ and $\\alpha = 10^{-2}$.\n\n```julia\nusing Gridap, PDENLPModels\n\n  # Definition of the domain\n  n = 100\n  domain = (-1, 1, -1, 1)\n  partition = (n, n)\n  model = CartesianDiscreteModel(domain, partition)\n\n  # Definition of the spaces:\n  valuetype = Float64\n  reffe = ReferenceFE(lagrangian, valuetype, 2)\n  Xpde = TestFESpace(model, reffe; conformity = :H1, dirichlet_tags = \"boundary\")\n  y0(x) = 0.0\n  Ypde = TrialFESpace(Xpde, y0)\n\n  reffe_con = ReferenceFE(lagrangian, valuetype, 1)\n  Xcon = TestFESpace(model, reffe_con; conformity = :H1)\n  Ycon = TrialFESpace(Xcon)\n\n  # Integration machinery\n  trian = Triangulation(model)\n  degree = 1\n  dΩ = Measure(trian, degree)\n\n  # Objective function:\n  yd(x) = -x[1]^2\n  α = 1e-2\n  function f(y, u)\n    ∫(0.5 * (yd - y) * (yd - y) + 0.5 * α * u * u) * dΩ\n  end\n\n  # Definition of the constraint operator\n  ω = π - 1 / 8\n  h(x) = -sin(ω * x[1]) * sin(ω * x[2])\n  function res(y, u, v)\n    ∫(∇(v) ⊙ ∇(y) - v * u - v * h) * dΩ\n  end\n\n  # initial guess\n  npde = num_free_dofs(Ypde)\n  ncon = num_free_dofs(Ycon)\n  xin = zeros(npde + ncon)\n\n  nlp = GridapPDENLPModel(xin, f, trian, Ypde, Ycon, Xpde, Xcon, res, name = \"Control elastic membrane\")\n```\n\n## References\n\n\n\u003e Migot, T., Orban D., \u0026 Siqueira A. S.\n\u003e PDENLPModels.jl: A NLPModel API for optimization problems with PDE-constraints\n\u003e Journal of Open Source Software 7(80), 4736 (2022).\n\u003e [10.21105/joss.04736](https://doi.org/10.21105/joss.04736)\n\u003e\n\u003e Badia, S., \u0026 Verdugo, F.\n\u003e Gridap: An extensible Finite Element toolbox in Julia.\n\u003e Journal of Open Source Software, 5(52), 2520 (2020).\n\u003e [10.21105/joss.02520](https://doi.org/10.21105/joss.02520)\n\n## How to Cite\n\nIf you use PDENLPModels.jl in your work, please cite using the format given in [CITATION.cff](https://github.com/JuliaSmoothOptimizers/PDENLPModels.jl/blob/main/CITATION.cff).\n\n# Bug reports and discussions\n\nIf you think you found a bug, feel free to open an [issue](https://github.com/JuliaSmoothOptimizers/PDENLPModels.jl/issues).\nFocused suggestions and requests can also be opened as issues. Before opening a pull request, start an issue or a discussion on the topic, please.\n\nIf you want to ask a question not suited for a bug report, feel free to start a discussion [here](https://github.com/JuliaSmoothOptimizers/Organization/discussions). This forum is for general discussion about this repository and the [JuliaSmoothOptimizers](https://github.com/JuliaSmoothOptimizers), so questions about any of our packages are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliasmoothoptimizers%2Fpdenlpmodels.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliasmoothoptimizers%2Fpdenlpmodels.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliasmoothoptimizers%2Fpdenlpmodels.jl/lists"}