Hi Alex, I investigated further and gave the whole thing some more thought. Conclusion: it is not a bug. I was partly successful setting the boundary conditions the way I wanted: it is possible to set a dirichlet condition for pressure and outflow conditions for the components and saturation by using values.setDirichlet(p0Idx, someComponentIdx). This way, I can set the pressure by replacing the mass balance of one component (which is constrained by the balance of the other components anyway). So for the outlet of my system, everything is fine. For the inlet, one flaw of the formulation of the mpnc model becomes clear: Theoretically, one component balance could be replaced by a balance equation for one phase. It should be possible because the component balance can be determined directly from the ones of the other components (sum of all mole fractions =1, everything in one phase gets transported due to the same pressure gradient). Doing this, advective systems could be determined much better from the boundary conditions: On the inlet of my system, I could set the flux of the gas phase AND the component fugacities. I think this is similar to the procedure in the 2pnc model (I need to check). With the current model this is not possible as one is forced to set either the fugacity (with Dirichlet) OR the component fluxes. I will check how big the effort is and maybe try to implement it...
Best regards Georg Von: Dumux [mailto:[email protected]] Im Auftrag von Alexander Kissinger Gesendet: Freitag, 14. August 2015 09:11 An: DuMuX User Forum Betreff: Re: [DuMuX] Boundary conditions Dear Georg, you are right I forgot that you are using the MPNC. I can not see where things are going wrong. What I would propose is to submit a bug-report to our bug tracking system, if you want I can do that for you. In that way the problem will dealt with at some point, hopefully soon. If you come up with a solution, please report it here. Best regards Alex On 13.08.2015 16:38, [email protected]<mailto:[email protected]> wrote: Hi Alex, I attached the relevant pieces of code in the file. Just to make sure we talk about the same thing: in the mpnc model there are N+M equations/primary variables for an isothermal system. This gives 5 equations for the 2p3c case and the primary variables are: Sg, pg, and three fugacities. The pressure and saturation are associated with the nonlinear complementarity functions (NCP equations), so it seems like if I set the pressure and saturation on a boundary but do not specify the mole fractions/fugacities, they are allowed to run wild and the solution is f***ed up :). I have a 2p2c fluidsystem at hand and tried it with that as well but the problem is the same. Seems like there is no easy solution to this. Georg Von: Dumux [mailto:[email protected]] Im Auftrag von Alexander Kissinger Gesendet: Donnerstag, 13. August 2015 15:44 An: DuMuX User Forum Betreff: Re: [DuMuX] Boundary conditions Dear Georg, I am not quite sure what causes your problem. Could you send the implementation of your boundary conditions, i.e. your boudaryTypes() and your dirichlet() function from your problem? You could also try the following: 1. Just set the pressure as a Dirichlet condition and make the other two equations outflow BC. 2. Try it with a 2p2c transport only system (set the third component to zero everywhere), do you still get unphysical values? Best regards Alex On 08/13/2015 01:56 PM, [email protected]<mailto:[email protected]> wrote: Hi Alex, I tried to do the same thing as in the 1p2coutflowproblem only with a 2p3c Fluidsystem and the mpnc model. Initially, only the gas phase is present in the whole domain (Sg=1) and I set Dirichlet boundary conditions for all primary variables on the inlet (pg = 1.6 bar, Sg=1 and the mole fractions/fugacities). Then I set Dirichlet conditions for pressure and saturation on the outlet (Sg=1, pg=1.5 bar). The Dirichlet conditions are consistent with the initial conditions. For the component conservation equations I set outflow conditions on the outlet. With these boundary conditions, everything should flow from the inlet to the outlet due to the pressure gradient of the gas phase. The gas phase composition may change on the way to the outlet due to reactions: 1 species is consumed, another produced. With the outflow bc everything that reaches the outlet should be allowed to leave the domain. Sadly, this is not working. I get unphysical mole fractions at the outlet (x > 1). Any clues why this does not work? Is the outflow condition used anywhere in a 2p-system? Best regards Georg Von: Dumux [mailto:[email protected]] Im Auftrag von Alexander Kissinger Gesendet: Freitag, 31. Juli 2015 16:21 An: DuMuX User Forum Betreff: Re: [DuMuX] Boundary conditions Dear Georg, If I understand correctly this means that whatever is on an outflow boundary is allowed to flow out or into the system. So if we assume pure fickian diffusion and the concentration in the domain is higher than on the boundary stuff will flow out while it is vice versa if the concentration is lower. If that is the case, what exactly is the difference to a Dirichlet boundary condition? As far as I see, with this type of boundary condition I would keep e.g. a concentration on the boundary constant. Am I correct? In the case of pure fickian diffusion (no advection i.e. constant pressure) the concentration at your outflow boundary would increase until the concentration gradient is zero i.e. no more flow. The difference between a Dirchlet boundary is that your concentration at the boundary dof is allowed to change with an outflow BC. Consider this example where the outflow boundary is more useful: 1d flow and transport in a tube (model: 1p2c). Left boundary has Neumann BC with fluid entering at a certain conentration. The right boundary has a Dirichlet BC for pressure (constant velocity in the tube) and an outflow boundary for the transported component. If the BC for the transported component were Dirichlet the concentration would stay at zero. With the outflow BC the concentration may increase at the boundary dof and the component may leave the domain through the advective flux. See also the test/implicit/1p2coutflowproblem. Best regards Alex On 07/31/2015 02:47 PM, [email protected]<mailto:[email protected]> wrote: Dear Alex, Thanks for your reply! "I am not sure if I got you right, you want to have a fixed Saturation (Dirichlet) for one phase and inject another phase? In Dumux you can choose the equation that should be replaced by the Dirichlet condition with the call: setDirichlet(int pvIdx, int eqIdx) The equation you choose cannot be assigned to a Neumann BC anymore. The rest of the equations can be assigned as Neumann BCs. Maybe you could list the type of BC you would like to have for each equation?" I found a workaround to calculate the fluxes at the outlet of my system, so now I set Dirichlet conditions at the inlet and solDependentNeumann conditions at the outlet. This should work. "For the box method the outflow condition uses the gradients evaluated at the integration point of the boundary face to calculate the flux out of the domain for the equation you choose." If I understand correctly this means that whatever is on an outflow boundary is allowed to flow out or into the system. So if we assume pure fickian diffusion and the concentration in the domain is higher than on the boundary stuff will flow out while it is vice versa if the concentration is lower. If that is the case, what exactly is the difference to a Dirichlet boundary condition? As far as I see, with this type of boundary condition I would keep e.g. a concentration on the boundary constant. Am I correct? Best regards Georg Von: Dumux [mailto:[email protected]] Im Auftrag von Alexander Kissinger Gesendet: Donnerstag, 30. Juli 2015 08:53 An: DuMuX User Forum Betreff: Re: [DuMuX] Boundary conditions Dear Georg, I am not sure if I got you right, you want to have a fixed Saturation (Dirichlet) for one phase and inject another phase? In Dumux you can choose the equation that should be replaced by the Dirichlet condition with the call: setDirichlet(int pvIdx, int eqIdx) The equation you choose cannot be assigned to a Neumann BC anymore. The rest of the equations can be assigned as Neumann BCs. Maybe you could list the type of BC you would like to have for each equation? Secondly, I stumbled across the outflow boundary condition recently what is the physical idea behind this type of boundary condition? For the box method the outflow condition uses the gradients evaluated at the integration point of the boundary face to calculate the flux out of the domain for the equation you choose. Best regards Alex On 29.07.2015 16:14, [email protected]<mailto:[email protected]> wrote: Hello Dumux, I am working with the (implicit, box) mpnc-model with a 2p5c fluidsystem and I would like to specify the following inlet boundary conditions to my system: gas pressure, saturation and phase composition. This can be done with a Dirichlet condition and it works fine. But additionally, I would like to set the gas flux into the model domain (basically the pressure gradient) which would mean setting a Neumann boundary condition. Is there a way to do this in Dumux? Secondly, I stumbled across the outflow boundary condition recently what is the physical idea behind this type of boundary condition? Thanks for your help! Georg Futter -------------------------- 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]<mailto:[email protected]> www.DLR.de<http://www.dlr.de/> _______________________________________________ Dumux mailing list [email protected]<mailto:[email protected]> https://listserv.uni-stuttgart.de/mailman/listinfo/dumux _______________________________________________ Dumux mailing list [email protected]<mailto:[email protected]> https://listserv.uni-stuttgart.de/mailman/listinfo/dumux -- Alexander Kissinger Institut für Wasser- und Umweltsystemmodellierung Lehrstuhl für Hydromechanik und Hydrosystemmodellierung Pfaffenwaldring 61 D-70569 Stuttgart Telefon: +49 (0) 711 685-64729 E-Mail: [email protected]<mailto:[email protected]> _______________________________________________ Dumux mailing list [email protected]<mailto:[email protected]> https://listserv.uni-stuttgart.de/mailman/listinfo/dumux -- Alexander Kissinger Institut für Wasser- und Umweltsystemmodellierung Lehrstuhl für Hydromechanik und Hydrosystemmodellierung Pfaffenwaldring 61 D-70569 Stuttgart Telefon: +49 (0) 711 685-64729 E-Mail: [email protected]<mailto:[email protected]> _______________________________________________ Dumux mailing list [email protected]<mailto:[email protected]> https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
_______________________________________________ Dumux mailing list [email protected] https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
