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/)
-   -   Gas permeation into solid: What boundary condition? (https://www.cfd-online.com/Forums/openfoam-solving/182080-gas-permeation-into-solid-what-boundary-condition.html)

cstuart December 30, 2016 08:27

Gas permeation into solid: What boundary condition?
 
Hello all,

I'm getting to grips with using OpenFOAM for the first time at the moment, so apologies for any obvious questions asked!
The simplified problem which I am starting with is one of mass diffusion through a solid and radioactive decay. For this I have written a very basic solver based on
dT/dt + λT - ∇^2 (DT)
No problems there, or at least none to be discussed in this thread.

I want to introduce the gaseous substance T to the solid via an interface to a mixture of gases including T. To do this, I see 3 possible solutions:
  1. Adapt the externalWallHeatFluxTemperature boundary condition
  2. Use a codedFixedValue BC
  3. Build a multi region solver?

The first option seems like the most elegant, given the similarity between the heat and mass diffusion problems and the fact that I will want to be able to model heat convection too later on, but looking at the source code doesn't immediately make it obvious to me how it works. It seems the important lines in "externalWallHeatFluxTemperatureFvPatchScalarField .C" [1] are 296-302:
Code:

            hp = 1.0/(1.0/h_ + totalSolidRes);

            Qr /= Tp;
            refGrad() = 0.0;
            refValue() = hp*Ta_/(hp - Qr);
            valueFraction() =
                (hp - Qr)/((hp - Qr) + kappa(Tp)*patch().deltaCoeffs());

but I don't see anything here which looks like a rearrangement of "-k grad(Tb) = h (T_a - Tb)" (with T_a and T_b as ambient and boundary temperatures) as I would expect. What exactly are the refValue and valueFraction supposed to be calculating (and where should I have been able to look that up myself)?

For the second option, I would perhaps calculate the flux in and multiply by a time step, adding this flux to the previous values in boundary cells? This doesn't strike me as the way things are supposed to be done in OpenFOAM, so I haven't investigated further than these examples [2] of using codedFixedValue.

Is maybe the third option the best, defining a new region which handles the "-k grad(Tb) = h (T_a - Tb)" equation and linking that region to the diffusion-through-a-solid region? Like I say, I am very new and have not yet learnt how that would work, but perhaps it turns out to be the simplest solution?

Thanks for any advice you can give.
Chris

[1] externalWallHeatFluxTemperatureFvPatchScalarField. C
[2] http://www.sourceflux.de/blog/the-co...ary-condition/


All times are GMT -4. The time now is 06:30.