but then grad pc = dpc/dsw*grad sw so setting grad pc*n = 0 should be same as grad s*n =0 if I'm not wrong?
Best regards, Timo > Am 12.08.2015 um 08:26 schrieb <[email protected]> <[email protected]>: > > I see… The saturation influences the fluxes only indirectly via the > pc-Sw-relation and the relative permeability. So it is not possible to set > grad(S)*n=0 even though the saturation is a primary variable. This is bad. I > need to think of something else. > > Thanks anyway J > > Von: Timo Koch [mailto:[email protected]] > Gesendet: Dienstag, 11. August 2015 17:56 > An: Futter, Georg; [email protected] > Betreff: Re: AW: [DuMuX] Boundary conditions > > Hi Georg, > > If you have grad(S) somewhere in your equation yes. Otherwise no. > > If you want to have a boundary condition like grad(S)*n = 0, calculate the > residual (the whole flux term, i.e. everything with a divergence in front) in > solDependentNeumann and just leave out the part of the flux that drops > because of grad(s)=0. By calculating I mean really calculate the residual in > the code using the current solution of the current newton step, i.e. your > value is still a function of the current primary variable not just a constant > value. > > This way you set grad(s) to zero but still assemble the other part of the > flux. > > All the best > Timo > > Am 11.08.2015 um 16:54 schrieb <[email protected]> <[email protected]>: > > Hi Timo, > > Thanks for your quick reply J. I guess the most basic problem I have is: is > it possible to set grad(S)=0 as a boundary condition? If yes, how can it be > done? > > Best regards > > Georg > > Von: Timo Koch [mailto:[email protected]] > Gesendet: Dienstag, 11. August 2015 16:03 > An: DuMuX User Forum; Futter, Georg > Betreff: Re: [DuMuX] Boundary conditions > > Dear Georg, > > when you set Dirichlet boundary conditions the equation gets replaced by the > Dirichlet boundary condition. I think that's what's clear. > When you set Neumann boundary conditions in Dumux you set a value for the > entire flux term (advective + diffusive part). So when you set a "no-flow" > flow condition meaning > you set the values in the neumann boundary function to zero you really get no > flow over the boundary -> F(advective + diffusive)*n = 0. If you set it to a > value, you set the whole flux to that value. > > If I understood correctly, this is NOT what you want to do in your example. > You want to set either the diffusive (something like grad c * n = 0) or the > advective (something like grad p * n = 0) part to zero and keep the other > part. > This is unfortunately not possible conveniently. What you have to do is to > use the function solDependentNeumann(). In that function (you probably know > the function) you have the current element volume variables at hand. > So, if you want to set the diffusive flux to zero, you calculate the > advective flux in the solDependentNeumann function -> the total flux gets > replaced by the advective flux. The same works of course the other way around. > You basically calculate the local residual inside the solDependentNeumann > function, leaving out either the advective or the diffusive flux. > Note that the values obtained from the solDependentNeumann function get > multiplied with the face area during assembly, so you don't have to / > shouldn't do that in the function already. > > I hope this works out for you. > > Timo > > On 08/11/2015 02:50 PM, [email protected] wrote: > Hello Dumux, > > I am still struggling with the boundary conditions for my system. What I want > to do for the cathode side of my fuel cell model is depicted in Figure1.jpg. > I want to simulate a fuel cell along one gas channel. I use the mpnc model > with a 2p3c-fluidsystem. On the inlet, gas is fed to the fuel cell which may > react along the channel. In the electrochemical reaction, O2 of the feed gas > is consumed and H2O is produced. If the current that is produced in the cell > is high enough, liquid water will be formed and transported to the outlet. > > What I know is: > 1. the total gas flux that goes into the system (depends on the current) > 2. The gas phase composition at the inlet ( all mole fractions) > 3. The saturation at the inlet (Sg=1) > 4. the total flux that goes out of the system (I can calculate that > because I know the sources and sinks for H2O and O2 (see below)) > 5. the gas pressure at the outlet > > What I want to determine from the Simulation: > 1. the gas pressure at the inlet > 2. the saturation at the outlet > > For the boundary conditions at the outlet, I assume the following: > 1. No gravity > 2. Pure advection > 3. Grad(x_alpha^kappa) = 0 à no diffusion, perfect mixing > 4. Grad(pg) = grad(pl) = grad(p), this means grad(Sg) = grad(Sl) = 0 > > With that, the molar flux out of the system of species kappa will read: > > > <image001.png> > > (1) > > The flux of Oxygen out of the system can be calculated via Faradays law: > > > <image002.png> > > > (2) > > Where lambda is the stoichiometry factor for the fuel cell operation. A value > of lambda = 2 means that twice as much oxygen is fed to the cell as is needed > to draw the desired current and (labda-1) represents the amount of O2 that is > not consumed in the reaction (the amount that goes out). Further, I is the > cell current, 4 is the number of electrons which is transferred in the > reaction, F is Faradays constant, A is the Area of the Channel outlet and n > is the normal vector. > With that, the pressure gradient at the outlet can be calculated from (1) and > (2): > > > <image003.png> > > > > (3) > > > Inserting (3) in (1) gives the flux of an arbitrary species at the outlet: > > > <image004.png> > > > > > (4) > > > > Now I want to set these fluxes as Neumann conditions on the outlet for the > component conservation equations. Any comments/objections on that? > Additionally, I want to set the pressure at the outlet using a Dirichlet > condition. > For the saturation at the outlet I don’t know which type of boundary > condition I can use. I don’t know the value of the saturation at the outlet > so Dirichlet is not an option. Will setting a Neumann condition > (values[s0Idx] = 0.0) mean that the gradient of saturation is 0? Or what will > happen if I use values.setOutflow(s0Idx)? > Also, I don’t know what to do with the pressure at the inlet. Its value > should be determined by the simulation so again, Dirichlet is not an option. > Would setting a Neumann condition (values[p0Idx] = molarGasFluxIn) mean I set > the corresponding pressure gradient? > Or could one also use an outflow condition for the pressure? > > Thanks for your help > > Georg > > —————————————————————————— > German Aerospace Center (DLR) > Institute of Engineering Thermodynamics | Computational Electrochemistry | > Pfaffenwaldring 38-40 | 70569 Stuttgart > > Dipl.-Ing. Georg Futter | Ph.D. student > Telefon 0711/6862-8135 | [email protected] > www.DLR.de > > > > > > > _______________________________________________ > Dumux mailing list > [email protected] > https://listserv.uni-stuttgart.de/mailman/listinfo/dumux > > > > > -- > ____________________________________________________________________ > > Timo Koch phone: +49 711 685 64676 > IWS, Universität Stuttgart fax: +49 711 685 60430 > Pfaffenwaldring 61 email: [email protected] > D-70569 Stuttgart url: www.hydrosys.uni-stuttgart.de > ____________________________________________________________________
_______________________________________________ Dumux mailing list [email protected] https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
