CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Inadvertent Dirichlet discontinuity (https://www.cfd-online.com/Forums/openfoam-solving/245409-inadvertent-dirichlet-discontinuity.html)

celestial October 4, 2022 18:33

Inadvertent Dirichlet discontinuity
 
Hi

Let's say that in foam-extend we have

coupledFvScalarMatrix TEqns(2);

TEqns.set
(
fvm::ddt(T) + fvm::div(phi, T)
- fvm::laplacian(DT, T)
);

TEqns.set
(
fvm::ddt(T2) - fvm::laplacian(DT2, T2)
);

TEqns.solve();

where T is on a mesh conformal to that where T2 is defined.

If in the dictionaries, we defined a FixedValue for T on the patch common to both meshes, that is different from a FixedValue for T2 on that same patch, then, which of these two values apply in the above solve() ?

Regards

celestial October 20, 2022 21:43

The answer is obvious: Both values and the program will bomb out because it is solving an inconsistent set of equations Ax=b : we have row i = row k of matrix A and bi not equal to bk (b = [b1,...bi,....,bk,....]

Anyhow both meshes contribute the same boundary condition to the combined matrix A. Simply do not add the duplicate one. The meshes do not need to be conformal (same points for the patch interface in common) but it makes the problem easier to solve (no interpolation required) I still have to find a way to add a boundary condition that involves variables on both meshes to matrix A. I will keep you posted unless somebody can tell me how it's done.

Thank you for viewing

celestial November 14, 2022 21:02

Use Elmer instead
 
After an exhaustive, exhausting and fruitless search of foam-extend, I am sure there is no way to store values a, b, c, and d for the following boundary condition between two domains for a scalar field X:

a * Xp + b * X1 + c * X2 = d

where X1(2) is the value of X at the center of a cell on the domain 1 (2) and both cells have exactly the same patch points. Xp is of course the value of X on a patch point.

Therefore, I recommend anybody who wants to solve a Poisson equation with a discontinuity in the electric field between two domains, to get familiar with Fortran FEM code Elmer from Finland and in addition, with Eof from Latvia if you are interested in coupling Elmer to other equations you may want to solve in OpenFOAM over a single domain. This is because Elmer has a solver StatElecSolver that automatically handles that discontinuity. All you need to do is add in a dictionary, the electrical permittivities of the two domains and the surface charge on the common boundary. You could use it to solve for temperature in a steady state diffusion equation by specifying the heat conductivities on both sides.

I realize it is going to be a steep learning curve for most people, but I do not see another way out.
Thanks for viewing

Marc


All times are GMT -4. The time now is 22:41.