CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   How can I do a solidWallMixedVoltageCoupled patch in chtMultiRegionFoam? (

Niklas Järvstråt March 2, 2010 10:23

How can I do a solidWallMixedVoltageCoupled patch in chtMultiRegionFoam?
I am trying to use a very simple calculation of electric potential field solver with chtMultiRegionFoam. I can run the solver and get nice potential fields with fixed boundary conditions. However, I cannot seem to get the interface patch, solidWallMixedTemperatureCoupledFvPatchScalarField , to work.
First, I tried just assigning the electric field instead of temperature in changeDictionaryDict of the System subdirectories:

type solidWallMixedTemperatureCoupled;
neighbourFieldName Vel;
sigma sigma;
value uniform 400;

Vel is my introduced electric potential field, and sigma the electric resistivity. The calculation starts, but soon diverges as there is no coupling.

Then I tried making a copy of solidWallMixedTemperatureCoupledFvPatchScalarField specifically for the potential field, replacing all "T" by "Vel" and all "K" by "sigma", but essentially it was just a renaming excercise as I don't understand the structure well enough.
My question is what needs to be changed in solidWallMixedTemperatureCoupledFvPatchScalarField .H(and .C) and/or the input files to couple another field than temperature?

for details about the problem.

Niklas Järvstråt March 16, 2010 06:13

Flux seems to work...
Hi Again, seems I am too vague or have an odd problem as no response so far. :( However, I have tried some more, running with the subroutines I made, and it seems the problem is in transferring the value of the voltage, while the flux *is* transferred in the other direction, at least somehow.
I run a simulation with homogeneous zero start voltage and only one region("wire") has one external boundary at non-zero voltage(400). The first increment all other regions voltage stays zero, while the one with a non-zero boundary reaches that boundary value homogenously. In the second increment, the neighbouring region reaches a homogeneous and ridiculously high voltage(8.3e+18), while the wire now seems to have the boundary to the surrounding region set to 200 !? (Incidentally, I used 200 there in the previous simulation, but the value was not used this time.)
Am I calling variables that have not been assigned values?

In createSolidFields I have added the lines:
PtrList<volScalarField> VSolid(solidRegions.size());
Info<< " Adding to VSolid\n" << endl;
new volScalarField

Niklas Järvstråt April 1, 2010 05:22

Neighbour gradient needed?
Hi again, somebody.
It seems as if I am actually using the interface patch correctly, but the interface is highly unstable for the electric field integration. I'm now trying to implement a consistent interface patch instead, but due to my inexperience with C++ and openFOAM, I am struggling to get hold of the neighbour gradient that I need.

In the original, the gradient is assigned to the interface by
tmp<scalarField> normalGradient = (*this-intFld())*patch().deltaCoeffs();
But I do not understand what value "*this" has at this point of the code, and anyway I seem to need the gradient both in the neighbour element and in "my" element.
And anyway, should you not divide by the deltas instead of myltiplying with them to get the gradient?

All times are GMT -4. The time now is 09:49.