# \#variational-form

**URL:** https://fenicsproject.discourse.group/tag/variational-form/37.md

[Latest](https://fenicsproject.discourse.group/latest.md) · [Categories](https://fenicsproject.discourse.group/categories.md) · [Tags](https://fenicsproject.discourse.group/tags.md)

---

## [How are 1st-order differential equations handled?](https://fenicsproject.discourse.group/t/how-are-1st-order-differential-equations-handled/19807)

<div class="topic-metadata">

**Author:** [@fea](https://fenicsproject.discourse.group/u/fea)\
**Replies:** 4\
**Last updated:** [September 8, 2026, 11:26am UTC](https://fenicsproject.discourse.group/t/how-are-1st-order-differential-equations-handled/19807 "2026-09-08T11:26:36Z")

</div>

I’m on Dolfinx version 0.10.0, and I wanted to perform \\int\_0^x f(x) dx by converting the integral into a 1st-order ODE \\frac{du}{dx} = f(x) \\ \\ \\ \\ \\forall x\\in 0\\le x\\le L with f(x) = 1-2x, u(L) = 0; the exact solut…

---

## [Newton divergence in 2D nonlinear Two-Temperature Model (TTM) FEM — dolfinx + complex PETSc](https://fenicsproject.discourse.group/t/newton-divergence-in-2d-nonlinear-two-temperature-model-ttm-fem-dolfinx-complex-petsc/18191)

<div class="topic-metadata">

**Author:** [@GVourvachakis](https://fenicsproject.discourse.group/u/GVourvachakis)\
**Replies:** 2\
**Last updated:** [July 19, 2026, 7:20pm UTC](https://fenicsproject.discourse.group/t/newton-divergence-in-2d-nonlinear-two-temperature-model-ttm-fem-dolfinx-complex-petsc/18191 "2026-07-19T19:20:23Z")

</div>

Hi everyone, I am developing a FEM solution of the parabolic 2D two-temperature model (TTM) composed of a system of second-order non-linear coupled PDEs (cf. eq.5 here with an additional lattice heat flux term under Fou…

---

## [Computing derivative of residual vector w.r.t material parameter for finite element model updating](https://fenicsproject.discourse.group/t/computing-derivative-of-residual-vector-w-r-t-material-parameter-for-finite-element-model-updating/18426)

<div class="topic-metadata">

**Author:** [@SolidMechanicsFan](https://fenicsproject.discourse.group/u/SolidMechanicsFan)\
**Replies:** 7\
**Last updated:** [July 4, 2026, 5:30pm UTC](https://fenicsproject.discourse.group/t/computing-derivative-of-residual-vector-w-r-t-material-parameter-for-finite-element-model-updating/18426 "2026-07-04T17:30:06Z")

</div>

Hi all, I am doing finite-element model updating for hyperelastic material models where I need analytic sensitivities of the residual w.r.t. constant material parameters: \\frac{\\partial \\mathbf{R}}{\\partial m} \\in \\mat…

---

## [How to improve accuracy of enforced integral constraints involving derivatives](https://fenicsproject.discourse.group/t/how-to-improve-accuracy-of-enforced-integral-constraints-involving-derivatives/19266)

<div class="topic-metadata">

**Author:** [@fea](https://fenicsproject.discourse.group/u/fea)\
**Replies:** 4\
**Last updated:** [January 8, 2026, 7:50am UTC](https://fenicsproject.discourse.group/t/how-to-improve-accuracy-of-enforced-integral-constraints-involving-derivatives/19266 "2026-01-08T07:50:46Z")

</div>

If the constraint does not involve a derivative, like say \\int\_\\Omega u dx = C, the constraint is satisfied to within machine precision, however this is not the case if a derivative is involved. I could always just incre…

---

## [Space-Time weak formulation](https://fenicsproject.discourse.group/t/space-time-weak-formulation/19303)

<div class="topic-metadata">

**Author:** [@LichtBringer](https://fenicsproject.discourse.group/u/LichtBringer)\
**Replies:** 4\
**Last updated:** [January 6, 2026, 12:04pm UTC](https://fenicsproject.discourse.group/t/space-time-weak-formulation/19303 "2026-01-06T12:04:52Z")

</div>

Hello dear community, i’m new to FEniCSx. I was wondering if it was actually possible to write the weak spacetime formulation as defined in this thesis document: https://theses.hal.science/tel-03810677v1/document (Sec…

---

## [Pathological Asymmetry in Projected Function](https://fenicsproject.discourse.group/t/pathological-asymmetry-in-projected-function/18398)

<div class="topic-metadata">

**Author:** [@zaccandels](https://fenicsproject.discourse.group/u/zaccandels)\
**Replies:** 2\
**Last updated:** [November 26, 2025, 5:17pm UTC](https://fenicsproject.discourse.group/t/pathological-asymmetry-in-projected-function/18398 "2025-11-26T17:17:29Z")

</div>

First thing, I’m using FEniCS 2019.1.0. In the MWE pasted below, I initialize a function phi\_n by projecting the right-hand side of the equation \\phi(x,y) = 0.5 - 0.5 \\tanh\\biggl( 2 \\frac{ \\sqrt{ (x - x\_c)^2 + (y- y\_c)…

---

## [Implementing Gradient Descent in FEniCS](https://fenicsproject.discourse.group/t/implementing-gradient-descent-in-fenics/13761)

<div class="topic-metadata">

**Author:** [@Shoham\_Sen](https://fenicsproject.discourse.group/u/Shoham_Sen)\
**Replies:** 8\
**Last updated:** [October 29, 2025, 9:35am UTC](https://fenicsproject.discourse.group/t/implementing-gradient-descent-in-fenics/13761 "2025-10-29T09:35:00Z")

</div>

I want to implement a Gradient Descent Algorithm in FEniCS. I am working in 1D (if this works out I can move onto 2D). My expression for the energy is ( I choose a simple one for now) E\[u\]=\\int\_0^{L} (1-u)^2 dx I pres…

---

## [dolfinX : How to calculate a gradient/derivative and get it as a numpy.array?](https://fenicsproject.discourse.group/t/dolfinx-how-to-calculate-a-gradient-derivative-and-get-it-as-a-numpy-array/17929)

<div class="topic-metadata">

**Author:** [@Romai2m](https://fenicsproject.discourse.group/u/Romai2m)\
**Replies:** 2\
**Last updated:** [July 11, 2025, 3:06pm UTC](https://fenicsproject.discourse.group/t/dolfinx-how-to-calculate-a-gradient-derivative-and-get-it-as-a-numpy-array/17929 "2025-07-11T15:06:38Z")

</div>

Hello everyone, Dolfinx version is 0.7.3 and have been installed with conda. Other version I need in the minimal code (at the bottom of the post) are : numpy : 1.26.4 mpi4py : 3.1.6 ufl : 2.23.2.0 Context : I’m solv…

---

## [Compute reaction forces for a dynamic case](https://fenicsproject.discourse.group/t/compute-reaction-forces-for-a-dynamic-case/17828)

<div class="topic-metadata">

**Author:** [@umarkhayaz](https://fenicsproject.discourse.group/u/umarkhayaz)\
**Replies:** 0\
**Last updated:** [June 23, 2025, 11:39pm UTC](https://fenicsproject.discourse.group/t/compute-reaction-forces-for-a-dynamic-case/17828 "2025-06-23T23:39:12Z")

</div>

Hi, I’m working on a dynamic fracture simulation in legacy DOLFINx, where I’ve implemented the HHT-α time‐integration scheme (see the elastodynamics demo, implemented before here: https://comet-fenics.readthedocs.io/en/…

---

## [Coupling 2D FEM transient EM model with 0D circuit equation in DOLFINx](https://fenicsproject.discourse.group/t/coupling-2d-fem-transient-em-model-with-0d-circuit-equation-in-dolfinx/17771)

<div class="topic-metadata">

**Author:** [@mnotazio](https://fenicsproject.discourse.group/u/mnotazio)\
**Replies:** 7\
**Last updated:** [June 20, 2025, 3:17pm UTC](https://fenicsproject.discourse.group/t/coupling-2d-fem-transient-em-model-with-0d-circuit-equation-in-dolfinx/17771 "2025-06-20T15:17:33Z")

</div>

Dear @dokken and all, I’m working with DOLFINx 0.9 to simulate the time evolution of eddy currents in a 2D axisymmetric electromagnetic model. The model is driven by a decaying toroidal current, and the goal is to evalu…

---

## [First order derivatives in non-linear problem](https://fenicsproject.discourse.group/t/first-order-derivatives-in-non-linear-problem/17737)

<div class="topic-metadata">

**Author:** [@mariom121](https://fenicsproject.discourse.group/u/mariom121)\
**Replies:** 0\
**Last updated:** [June 11, 2025, 5:55pm UTC](https://fenicsproject.discourse.group/t/first-order-derivatives-in-non-linear-problem/17737 "2025-06-11T17:55:26Z")

</div>

Dear FenicsX users, I am trying to solve the following non-linear problem: On the \[0,1\] one-dimensional interval with homogeneous Neumann boundary conditions for u. I have been able to successfully solve other non-l…

---

## [Solve linear systems in iterative algorithm - Higher order elements](https://fenicsproject.discourse.group/t/solve-linear-systems-in-iterative-algorithm-higher-order-elements/17524)

<div class="topic-metadata">

**Author:** [@kalosu](https://fenicsproject.discourse.group/u/kalosu)\
**Replies:** 0\
**Last updated:** [April 29, 2025, 1:06pm UTC](https://fenicsproject.discourse.group/t/solve-linear-systems-in-iterative-algorithm-higher-order-elements/17524 "2025-04-29T13:06:47Z")

</div>

Hello there friends from the fenics community, I want to ask for your help and guidance with some linear systems that I am trying to solve. I have a basic implementation of the algorithm shown in this paper: https://epu…

---

## [Module petsc4py not found on Anaconda](https://fenicsproject.discourse.group/t/module-petsc4py-not-found-on-anaconda/17315)

<div class="topic-metadata">

**Author:** [@Inuwashi](https://fenicsproject.discourse.group/u/Inuwashi)\
**Replies:** 1\
**Last updated:** [March 26, 2025, 4:08pm UTC](https://fenicsproject.discourse.group/t/module-petsc4py-not-found-on-anaconda/17315 "2025-03-26T16:08:56Z")

</div>

Hello, I’m posting here because I’m having an issue with the petsc4py module. I’m trying to solve the heat equation, and to create the variational form, I need to use dolfinx.fem.petsc.LinearProblem. However, the petsc …

---

## [Mixed form Poisson with in-homogeneous conductivity](https://fenicsproject.discourse.group/t/mixed-form-poisson-with-in-homogeneous-conductivity/17232)

<div class="topic-metadata">

**Author:** [@Kiri](https://fenicsproject.discourse.group/u/Kiri)\
**Replies:** 2\
**Last updated:** [March 18, 2025, 12:55pm UTC](https://fenicsproject.discourse.group/t/mixed-form-poisson-with-in-homogeneous-conductivity/17232 "2025-03-18T12:55:35Z")

</div>

Hi, What is the correct method for including spatially varying conductivity (i.e. multiple materials), \\kappa(\\boldsymbol{x}), in the mixed form of the Poisson equation? In particular, in my derivation below I am unsur…

---

## [Understanding and Implementing a Tangential Boundary Condition in Finite Element Methods](https://fenicsproject.discourse.group/t/understanding-and-implementing-a-tangential-boundary-condition-in-finite-element-methods/16915)

<div class="topic-metadata">

**Author:** [@pauldross](https://fenicsproject.discourse.group/u/pauldross)\
**Replies:** 4\
**Last updated:** [February 6, 2025, 11:13am UTC](https://fenicsproject.discourse.group/t/understanding-and-implementing-a-tangential-boundary-condition-in-finite-element-methods/16915 "2025-02-06T11:13:43Z")

</div>

I have a question regarding a peculiar boundary condition I have come across in a paper. For completeness I will state the notation relevant to my question. \\mathcal{V}\_h^r and \\mathbf{V}^r\_h denote the r th order Lagra…

---

## [Solving a system of coupled PDEs with different dimensions](https://fenicsproject.discourse.group/t/solving-a-system-of-coupled-pdes-with-different-dimensions/16655)

<div class="topic-metadata">

**Author:** [@Peyman\_H](https://fenicsproject.discourse.group/u/Peyman_H)\
**Replies:** 2\
**Last updated:** [January 3, 2025, 4:22pm UTC](https://fenicsproject.discourse.group/t/solving-a-system-of-coupled-pdes-with-different-dimensions/16655 "2025-01-03T16:22:41Z")

</div>

Hello, I have a question regarding this tutorial: Coupling PDEs of multiple dimensions I have used the same approach outlined in this tutorial to address my problem of solving partial differential equations (PDEs) in …

---

## [Elementwise multiplication in variational form / Hadamard product](https://fenicsproject.discourse.group/t/elementwise-multiplication-in-variational-form-hadamard-product/15754)

<div class="topic-metadata">

**Author:** [@jt509](https://fenicsproject.discourse.group/u/jt509)\
**Replies:** 1\
**Last updated:** [September 9, 2024, 7:36pm UTC](https://fenicsproject.discourse.group/t/elementwise-multiplication-in-variational-form-hadamard-product/15754 "2024-09-09T19:36:25Z")

</div>

Hi community I want to perform the operation A .\* v, for example \\begin{bmatrix} 1 & 2 & 3 \\\\ 4 & 5 & 6 \\\\ 7 & 8 & 9 \\end{bmatrix} .\* \\begin{bmatrix} 1 \\\\ 0 \\\\ 1 \\end{bmatrix} = \\begin{bmatrix} 1 & 0 & 3 \\\\ 4 & 0 & 6…

---

## [Got unexpected negative values when solving the convection-diffusion PDE](https://fenicsproject.discourse.group/t/got-unexpected-negative-values-when-solving-the-convection-diffusion-pde/15629)

<div class="topic-metadata">

**Author:** [@SnowColdplay](https://fenicsproject.discourse.group/u/SnowColdplay)\
**Replies:** 7\
**Last updated:** [September 6, 2024, 9:13am UTC](https://fenicsproject.discourse.group/t/got-unexpected-negative-values-when-solving-the-convection-diffusion-pde/15629 "2024-09-06T09:13:05Z")

</div>

Hi, FEniCS community, I have been stuck and confused with what seems to be a very simple problem for nearly two months, and I have debugged from several views, even I have calculated by hands for a 1×1 grid case. But st…

---

## [The problem of equation coefficients being functions of the previous time step](https://fenicsproject.discourse.group/t/the-problem-of-equation-coefficients-being-functions-of-the-previous-time-step/15048)

<div class="topic-metadata">

**Author:** [@wanghao](https://fenicsproject.discourse.group/u/wanghao)\
**Replies:** 3\
**Last updated:** [June 22, 2024, 5:42am UTC](https://fenicsproject.discourse.group/t/the-problem-of-equation-coefficients-being-functions-of-the-previous-time-step/15048 "2024-06-22T05:42:08Z")

</div>

Hi everyone! The coefficient c in a simple equation. For example: (un,phin)=ufl.TrialFunctions(W) (v,fai)=ufl.TestFunctions(W) c=10 FF1 = inner(delta\*un,v)\*dx-inner(delta\*un\_1,v)\*dx FF1 +=(-c\*inner(un,v)\*dx) FF1 …

---

## [Reducing equation system by manipulating matrices](https://fenicsproject.discourse.group/t/reducing-equation-system-by-manipulating-matrices/15009)

<div class="topic-metadata">

**Author:** [@jedi](https://fenicsproject.discourse.group/u/jedi)\
**Replies:** 1\
**Last updated:** [June 17, 2024, 5:04am UTC](https://fenicsproject.discourse.group/t/reducing-equation-system-by-manipulating-matrices/15009 "2024-06-17T05:04:18Z")

</div>

Hello I am currently using the following formulation to calculation EM eigenvalues # Formulate FEM problem a\_tt = ((1/m\_r)\*ufl.inner(ufl.curl(Et\_bf), ufl.curl(Et\_tf)) - (k0\*\*2) \* e\_r \* ufl.inner(Et\_bf, Et\_tf)) \* ufl.dx…

---

## [Hyperelastic deformation with applied pressue on internal surface](https://fenicsproject.discourse.group/t/hyperelastic-deformation-with-applied-pressue-on-internal-surface/14589)

<div class="topic-metadata">

**Author:** [@Chris\_S](https://fenicsproject.discourse.group/u/Chris_S)\
**Replies:** 6\
**Last updated:** [May 23, 2024, 1:08am UTC](https://fenicsproject.discourse.group/t/hyperelastic-deformation-with-applied-pressue-on-internal-surface/14589 "2024-05-23T01:08:35Z")

</div>

Hi Everyone, I posted this on slack already but here may be a better place. I am simulating an applied pressure onto a boundary of a hyperelastic material, which works well enough. That boundary is a hole in a rectangle …

---

## [Problem with solving Stokes with RT1-DG0?](https://fenicsproject.discourse.group/t/problem-with-solving-stokes-with-rt1-dg0/14676)

<div class="topic-metadata">

**Author:** [@August](https://fenicsproject.discourse.group/u/August)\
**Replies:** 0\
**Last updated:** [May 15, 2024, 12:08pm UTC](https://fenicsproject.discourse.group/t/problem-with-solving-stokes-with-rt1-dg0/14676 "2024-05-15T12:08:53Z")

</div>

Hi all, I am testing solving a basic Stokes problem with some different elements, and I have problems getting the correct solution with RT1-DG0. It works fine for RT2-DG0 and P2-P1 Taylor-Hood elements. Is there somethi…

---

## [Behaviour of 1D discontinuous Galerkin with LF flux for Burgers' eq](https://fenicsproject.discourse.group/t/behaviour-of-1d-discontinuous-galerkin-with-lf-flux-for-burgers-eq/13616)

<div class="topic-metadata">

**Author:** [@William\_Greenough](https://fenicsproject.discourse.group/u/William_Greenough)\
**Replies:** 3\
**Last updated:** [February 19, 2024, 3:35pm UTC](https://fenicsproject.discourse.group/t/behaviour-of-1d-discontinuous-galerkin-with-lf-flux-for-burgers-eq/13616 "2024-02-19T15:35:10Z")

</div>

Hello all. I am new to both fenics and finite element problems in general. I am trying to replicate the results found here: Bitbucket using implicit Euler time-stepping rather than spacetime finite elements. However, my…

---

## [How to debug the PETSC ERROR?](https://fenicsproject.discourse.group/t/how-to-debug-the-petsc-error/13406)

<div class="topic-metadata">

**Author:** [@Smith\_Jack](https://fenicsproject.discourse.group/u/Smith_Jack)\
**Replies:** 3\
**Last updated:** [January 25, 2024, 8:39am UTC](https://fenicsproject.discourse.group/t/how-to-debug-the-petsc-error/13406 "2024-01-25T08:39:51Z")

</div>

I am solving this PDE to get its steady state. the variational form is lengthy. When I solve the problem with the NonlinearProblem of petsc, it just complains some unhelpful PETSC ERRORs. In this case, how to debug m…
