# Deriving the weak form of my problem, is it correct?

**URL:** <https://fenicsproject.discourse.group/t/deriving-the-weak-form-of-my-problem-is-it-correct/17272>\
**Category:** General\
**Created:** [March 20, 2025, 4:41pm UTC](https://fenicsproject.discourse.group/t/deriving-the-weak-form-of-my-problem-is-it-correct/17272 "2025-03-20T16:41:29Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![raboynics](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@raboynics](https://fenicsproject.discourse.group/u/raboynics)\
**Post date:** [March 23, 2025, 11:33am UTC](https://fenicsproject.discourse.group/t/deriving-the-weak-form-of-my-problem-is-it-correct/17272/7 "2025-03-23T11:33:48Z")

</div>

> [@Stein](#):
>
> I don’t see how that follows from your text.
> 
> \vec J\_U \cdot n = -\kappa \nabla T \cdot n +T(S\vec J) \cdot n +V\vec J \cdot n = 0   
> Given J \cdot n = 0, you would get \kappa \nabla T \cdot n = T(S\vec J) \cdot n .

You’re absolutely right, this time an overlook from my part.

> [@Stein](#):
>
> Is this problem formulation what you’re trying to achieve?  
> \begin{cases} \nabla\cdot \vec J\_U = 0 \text{ in }\Omega\\ \nabla\cdot \vec J = 0 \text{ in }\Omega\\ J\cdot n = 0 \text{ on }\partial\Omega \\ T = T\_{D} \text{ on }\partial\Omega\_D \\ -\kappa\nabla T \cdot n= 0 \text{ on }\partial\Omega \setminus \partial\Omega\_D \end{cases}   
> with \vec J\_U = -\kappa \nabla T +T(S\vec J) +V\vec J and \vec J =-\sigma \nabla V - \sigma S \nabla T
> 
> Hmmm, I’ve puzzled for a bit, but I cannot come up with a clean weak form (without variational crimes) that corresponds to that PDE. To me, that hints at the incompatibility of those BCs, but I could be wrong.

I think you are right about your conclusion.  
Ok, thinking more about it, the 4 first conditions are an absolute must. The 5th condition is probably wrong (sorry about that!), I would rather have \vec J\_U \cdot \hat n=0 on the boundaries where no Dirichlet conditions are enforced.

I checked up quickly last night (between midnight and 1 am… I was tired to say the least) and I think my current problem is indeed like this, and I was wrong in claiming that \vec J\_U \cdot \hat n \neq 0 on the boundaries without any specified boundary conditions (FEniCSx returned numbers like 1e-4 or 1e-5 so I wasn’t sure if this was supposed to vanish or not, but since I used the usual non accurate way to compute fluxes, it may indeed be 0).

Therefore, to sum up, I think I want:  
 \begin{cases} \nabla\cdot \vec J\_U = 0 \text{ in }\Omega\\ \nabla\cdot \vec J = 0 \text{ in }\Omega\\ J\cdot n = 0 \text{ on }\partial\Omega \\ T = T\_{D} \text{ on }\partial\Omega\_D \\ \vec J\_U \cdot n= 0 \text{ on }\partial\Omega \setminus \partial\Omega\_D \end{cases} .

This would indeed imply that \kappa \nabla T \cdot \hat n = T(S\vec J) \cdot \hat n on the boundaries where I do not prescribe the Dirichlet b.c.s.

I am getting convinced this is what happens physically. It means that there are 2 boundaries from which energy enters and leave the system, which makes sense since the system is in thermal contact with reservoirs there, and the other 2 boundaries are thermally and electrically insulated. On those insulated boundaries, strangely \nabla T \neq \vec 0, but this is required for no energy exchange with the exterior, because TS\vec J \cdot \hat n \neq 0 there, too, which is a bit weird but apparently possible.

So nice, I think you basically either figured out yourself or at least helped me to understand what is going on in this uncommon system I am dealing with. Things that we take for granted are not necessarily valid anymore, like the thermal insulation implying \nabla T =\vec 0 does not hold in this thermoelectric system.

Thanks a lot Stein, for all the information and your patience.

My question would be, then, whether I am correctly modelling the 5 conditions with my current weak form (with the sigma term corrected)? I think so but I prefer to be 100% sure.

---

_[View the full topic](https://fenicsproject.discourse.group/t/deriving-the-weak-form-of-my-problem-is-it-correct/17272)._
