Skip to content
Back to skills

Deep Ritz Variational Energy Loss

ASecurity

Compute Deep Ritz variational energy losses with gradient energy and boundary penalties.

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 9, 2026
toolspythonbash

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill deep_ritz_variational_energy_loss --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Deep Ritz Variational Energy Loss?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Deep Ritz Variational Energy Loss
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-deep-ritz-variational-energy-loss/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-deep-ritz-variational-energy-loss)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: deep_ritz_variational_energy_loss
description: Compute Deep Ritz variational energy losses with gradient energy and boundary penalties.
---

# Deep Ritz Variational Energy Loss

## When To Use

Use this skill to turn sampled PDE points and a differentiable trial function into a Ritz objective. It is appropriate for Poisson-type energy minimization and can be extended to Rayleigh quotient eigenvalue objectives.

## Inputs

- Trial model `u(x; theta)`.
- Interior points with input gradients enabled.
- Boundary points and exact boundary values.
- Forcing function values `f(x)`.
- Boundary penalty coefficient `beta`.

## Outputs

- Scalar total loss.
- Interior energy, boundary penalty, and gradient-energy diagnostics.

## Workflow

1. Evaluate the trial function at interior points.
2. Differentiate outputs with respect to coordinates.
3. Estimate `mean(0.5 * |grad u|^2 - f * u)`.
4. Add `beta * mean((u_boundary - g_boundary)^2)`.
5. Backpropagate the resulting scalar during training.

## Validation

Run:

```bash
python tests/test_energy_loss.py
```

## Limitations

Automatic differentiation requires PyTorch or another autograd runtime. Standard-library helpers provide exact-solution functions and numeric diagnostics but cannot replace full gradient-energy training.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.