Hi Rafael,

this is not implemented in any convenient way. Probably because it’s not clear 
how to _visualise_ normal face fluxes in a useful way.
Vtk doesn’t support face quantities.

You can write out the skeleton (only the faces of the grid) if you need 
something for debugging or postprocessing.
There is a class “ConformingIntersectionWriter” in 
dumux/io/vtk/intersectionwriter.hh. You can add a face field with “addField”. 
It expect a vector with number of entries equal to the number of faces.

The indexing is gridView.indexSet().subIndex(element, localFacetIndex, 
/*codim=*/1) or gridView.indexSet().index(facet) where facet is a Dune codim<1> 
entity. The local localFacetIndex can be obtained from 
intersection.indexInInside().
Unfortunately there is no direct mapping from sub-control-volume-faces to 
intersections. Because you would compute normal flux in Dumux over 
sub-control-volume-faces you would have to find the intersection.
In your case you could e.g. check the normal vector:

////////////////////////////////////////////////////////////////////////////////////////////

const auto localFacetIndex = [&]{
    for (const auto& is : intersections(gridGeometry->gridView(), element))
        if (is.centerUnitOuterNormal()*scvf.unitOuterNormal() > 0.9)
            return is.indexInInside();
}();

const auto globalFacetIndex = 
gridGeometry->gridView().indexSet().subIndex(element, localFacetIndex, 
/*codim=*/1);
normalFluxes[globalFacetIndex] = flux; 

////////////////////////////////////////////////////////////////////////////////////////////

assuming you have computef the normal face flux (flux) for this scvf.
For writing out:

////////////////////////////////////////////////////////////////////////////////////////////

std::vector<double> normalFluxes(gridGeometry->gridView().size(1));

// fill the vector here

ConformingIntersectionWriter faceVtk(gridGeometry->gridView());
faceVtk.addField(normalFluxes, “normal flux");
faceVtk.write("output", Dune::VTK::ascii);

////////////////////////////////////////////////////////////////////////////////////////////

Best wishes
Timo


> On 5 Nov 2022, at 15:10, Rafael March <[email protected]> wrote:
> 
> Hello, 
> 
> How to output normal face fluxes in the VTU files?
> 
> I'm using a cell-centered TPFA scheme (two-phase) with a YASP (cartesian) 
> grid. Hence, the fluxes are stored in the grid faces, normal to each face. I 
> would like to see these fluxes in the VTU files. I thought this would do the 
> trick:
> 
> vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
> 
> But it doesn't. Can you point me in the right direction?
> 
> Thank you!
> 
> Rafael March.
> _______________________________________________
> 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