Hi Nikolai,

I wouldn't pass the assembler to the subproblem constructor, as you would need to know the type. You could define a function in your problem  that has the assembler as template argument, something like:


template<class Assembler>

void computeFluxes(const Assembler& assembler, ...) {...}


If you don't really need the fluxes in your problem, i.e. if it is just for output purposes, I would write the function in a separate header or simply put it in the main file at the end of a time step.


Best,
Dennis


On 27.10.19 17:29, Nikolai Andrianov wrote:
Hi Dennis,

Thanks a lot for your prompt reply!

How do I pass the assembler to the matrix subproblem? Shall I rewrite the constructor of matrix subproblem or there is another option?

Or shall I write the loop through elements in the main(), where I have an instance of the assembler?

Best regards,
Nikolai
------------------------------------------------------------------------
*From:* Dennis Gläser <[email protected]>
*Sent:* Sunday, October 27, 2019 4:36:16 PM
*To:* [email protected]; Nikolai Andrianov
*Subject:* Re: [DuMuX] Calculate the flux at fracture-matrix interfaces

Hi Nikolai,


I suppose you meant 3.0? To my knowledge this feature was not available in 2.12.


In any case, the reason for this error is because the coupling manager stores the data from the coupled domain that is required for flux computations. Currently, this requires the coupling manager to be bound to an element, just as you do for the ElementVolumeVariables etc. So, for example, computing fluxes across an element of the matrix domain would require the following "bind" calls beforehand:


couplingManager.bindCouplingContext(matrixDomainId, matrixElement, assembler);

fvGeometry.bind(matrixElement);

elemVolVars.bind(matrixElement, fvGeometry, matrixSolution);

elemFluxVarsCache.bind(matrixElement, fvGeometry, elemVolVars);


I suppose the last three lines are in your code already. The only thing you are currently missing is the binding of the coupling manager (first line). It needs the domain id of the element you are binding it too, the element itself and (unfortunately) the assembler. We are not happy with this dependency, especially because it requires the assembler to be passed to it.


We have found a solution to get around the necessity to call "bindCouplingContext()", but this is still on a development branch though and will be incorporated until the next release. Until then, you will have to bind the coupling manager prior to element-local computations, sorry about that.


I hope this works!


Best wishes,
Dennis





On 27.10.19 13:11, Nikolai Andrianov wrote:

Dear experts,


I would like to calculate the flux across the fracture-matrix interfaces, but get a runtime error when using the code below (a part of my matrixproblem.hh):

                FluxVariables fluxVars;
                fluxVars.init(*this, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);

                if (couplingManager().isOnInteriorBoundary(element, scvf))
                {
                        Scalar flux = fluxVars.advectiveFlux(FluidSystem::phase0Idx, upwindTerm);    // <-- Runtime error here
                        std::cout << ", flux=" << flux << std::endl;
                        mfFlux += flux;
                }

The code successfully prints the flux for a first scvf but gives the following error message on a second scvf: "Assertion `std::find(s.begin(), s.end(), lowDimElemIdx) != s.end()' failed.'

The error message occurs in couplingManager().getLowDimVolVars(). It seems that the low-dimensional element can be found, but the corresponding volume variables cannot be linked.

Appreciate your help 😊

Thanks,
Nikolai

PS I am (still) using Dumux 2.12..



_______________________________________________
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