Kilian,

Thank you, it seems to be what I need indeed. I will take a closer look.

Best regards,

Dmitry

On 26.05.2020 15:06, Kilian Weishaupt wrote:
Hi Dmitry,

we have implemented an outflow condition for Box in the 1p2c isothermal test.

Maybe you can adapt it to your needs (see below)

Best wishes

Kilian


    template<bool useBox = isBox, std::enable_if_t<useBox, int> = 0>
    NumEqVector neumann(const Element& element,
                        const FVElementGeometry& fvGeometry,
                        const ElementVolumeVariables& elemVolVars,
                        const ElementFluxVariablesCache& elemFluxVarsCache,
                        const SubControlVolumeFace& scvf) const
    {
        // no-flow everywhere except at the right boundary
        NumEqVector values(0.0);
        const auto xMax = this->gridGeometry().bBoxMax()[0];
        const auto& ipGlobal = scvf.ipGlobal();
        if (ipGlobal[0] < xMax - eps_)
            return values;

        // set a fixed pressure on the right side of the domain
        static const Scalar dirichletPressure = 1e5;
        const auto& volVars = elemVolVars[scvf.insideScvIdx()];
        const auto& fluxVarsCache = elemFluxVarsCache[scvf];

        // evaluate the pressure gradient
        GlobalPosition gradP(0.0);
        for (const auto& scv : scvs(fvGeometry))
        {
            const auto xIp = scv.dofPosition()[0];
            auto tmp = fluxVarsCache.gradN(scv.localDofIndex());
            tmp *= xIp > xMax - eps_ ? dirichletPressure
                                     : elemVolVars[scv].pressure();
            gradP += tmp;
        }

        // compute flux
        auto phaseFlux = vtmv(scvf.unitOuterNormal(), volVars.permeability(), gradP);         phaseFlux *= useMoles ? volVars.molarDensity() : volVars.density();
        phaseFlux *= volVars.mobility();

        // set Neumann bc values
        values[contiH2OEqIdx] = phaseFlux;
        // emulate an outflow condition for the component transport on the right side         values[contiN2EqIdx] = phaseFlux * ( useMoles ? volVars.moleFraction(0, N2Idx) : volVars.massFraction(0, N2Idx) );

        return values;
    }

On 26.05.20 13:41, Dmitry Pavlov wrote:

I see that dirichletAtPos() is available for Box method, too, but in fact, I must use neumann() because by boundary conditions are more complex than just the constant pressure. I have a two-phase flow and need to implement a certain equation on the outflux of different phases, depending on the pressure gradient.

Best regards,

Dmitry


On 26.05.2020 14:08, Dmitry Pavlov wrote:
Hello,

After transition from the CC method to the Box method in my 1d porous medium flow problem, I am wondering how I should specify a constant pressure boundary condition.

With the CC method, it was relatively easy: I could either implement dirichletAtPos(), or implement neumann() instead and calculate the flux across the boundary from the pressure gradient as

gradp = ([boundary pressure] - [pressure in the center of the cell]) / (half-width of the cell)

With the Box method, though, it is no longer obvious to me. I will appreciate any pointers. I see addCCDirichletFluxDerivatives in the DuMux code, but no similar method for Box method.

Best regards,

Dmitry


_______________________________________________
Dumux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

_______________________________________________
Dumux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to