Re: [DuMux] Output face fluxes in VTU

2022-11-05 Thread Timo Koch
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 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  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(*gridVariables));
> 
> But it doesn't. Can you point me in the right direction?
> 
> Thank you!
> 
> Rafael March.
> ___
> DuMux mailing list
> DuMux@listserv.uni-stuttgart.de
> https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

___
DuMux mailing list
DuMux@listserv.uni-stuttgart.de
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux


Re: [DuMux] Alugrid - error

2022-11-05 Thread Timo Koch

5. nov. 2022 kl. 12:32 skrev kenza bouznari :


Thank you for pointing that out. You are right, I had to change it, but now I 
get a new error that says :
WARNING (ignored): Could not open file 'alugrid.cfg', using default values 0 < 
[balance] < 1.2, partitioning method 'ALUGRID_SpaceFillingCurve(9)'.


Hi,

that‘s not an error. It‘s a warning. And it says it‘s being ignored. There 
should be nothing wrong with this. You could open an issue in dune-alugrid for 
the alugrid developers that their „warning“ (just an info in my opinion) looks 
a bit aggressive.

Best
Timo


Best regards,
Kenza


Le ven. 4 nov. 2022 à 19:38, Timo Koch 
mailto:timok...@math.uio.no>> a écrit :
Hi Kenza,

the exception tells you exactly what’s wrong. You specified “parameters 1” so 
it expects one parameter per simplex.
But your simplices don’t have parameters associated. In the first line (as also 
in all following lines) of the simplex block there is just the four vertices 
and no fifth number afterwards (the expected parameter).

Best,
Timo


On 4 Nov 2022, at 21:38, kenza bouznari 
mailto:bouznari.ke...@gmail.com>> wrote:

Hi Timo,

Yes, I did and to make sure that the modifications in the source files are well 
done, I tested by using a simple 3D [Grid] in the input file, and it did work. 
So I believe that the problem is in the *.dgf file and how it's read by the 
code.

Best regards,
Kenza

Le ven. 4 nov. 2022 à 15:33, Timo Koch 
mailto:timok...@math.uio.no>> a écrit :
Hi Kenza,

did you change the AluGrid type in the Grid property from 2D to 3D? This is a 
compile time parameter.

Best,
Timo

4. nov. 2022 kl. 19:51 skrev kenza bouznari 
mailto:bouznari.ke...@gmail.com>>:


Dear DuMux users,

I have installed ALUGrid and successfully built DuMux and run 
test_2p2c_injection_box. I also made all the required modifications in source 
code files (problem.hh main.cc etc). The meshgrid in my 
simulations is read from an external *.dgf file. For my 2D simulations, all 
went quite well and now I want to switch to 3D simulations. I get the following 
error whenever I try to run the test:
  what():  DGFException 
[next:/home/bkenza/Dumux_3.4_AN/dumux/dune-grid/dune/grid/io/file/dgfparser/blocks/simplex.cc:134]:
 Error in block SIMPLEX (line 1): Wrong number of simplex parameters (got 0, 
expected 1)

P.S: I also attached an example of the *.dgf file I am using.

I need your help to figure out what I am doing wrong or what's the problem with 
the first line of the *.dgf file simplex block, and how can I potentially fix 
it?

Thank you in advance,
Kenza
___
DuMux mailing list
DuMux@listserv.uni-stuttgart.de
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

___
DuMux mailing list
DuMux@listserv.uni-stuttgart.de
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux


[DuMux] Output face fluxes in VTU

2022-11-05 Thread Rafael March
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(*gridVariables));

But it doesn't. Can you point me in the right direction?

Thank you!

Rafael March.
___
DuMux mailing list
DuMux@listserv.uni-stuttgart.de
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux


Re: [DuMux] Alugrid - error

2022-11-05 Thread kenza bouznari
Thank you for pointing that out. You are right, I had to change it, but now
I get a new error that says :
*WARNING (ignored): Could not open file 'alugrid.cfg', using default values
0 < [balance] < 1.2, partitioning method 'ALUGRID_SpaceFillingCurve(9)'.*

Best regards,
Kenza


Le ven. 4 nov. 2022 à 19:38, Timo Koch  a écrit :

> Hi Kenza,
>
> the exception tells you exactly what’s wrong. You specified “parameters 1”
> so it expects one parameter per simplex.
> But your simplices don’t have parameters associated. In the first line (as
> also in all following lines) of the simplex block there is just the four
> vertices and no fifth number afterwards (the expected parameter).
>
> Best,
> Timo
>
>
> On 4 Nov 2022, at 21:38, kenza bouznari  wrote:
>
> Hi Timo,
>
> Yes, I did and to make sure that the modifications in the source files are
> well done, I tested by using a simple 3D [Grid] in the input file, and it
> did work. So I believe that the problem is in the *.dgf file and how it's
> read by the code.
>
> Best regards,
> Kenza
>
> Le ven. 4 nov. 2022 à 15:33, Timo Koch  a écrit :
>
>> Hi Kenza,
>>
>> did you change the AluGrid type in the Grid property from 2D to 3D? This
>> is a compile time parameter.
>>
>> Best,
>> Timo
>>
>> 4. nov. 2022 kl. 19:51 skrev kenza bouznari :
>>
>> 
>> Dear DuMux users,
>>
>> I have installed ALUGrid and successfully built DuMux and run
>> test_2p2c_injection_box. I also made all the required modifications in
>> source code files (problem.hh main.cc etc). The meshgrid in my
>> simulations is read from an external *.dgf file. For my 2D simulations, all
>> went quite well and now I want to switch to 3D simulations. I get the
>> following error whenever I try to run the test:
>>
>> *  what():  DGFException
>> [next:/home/bkenza/Dumux_3.4_AN/dumux/dune-grid/dune/grid/io/file/dgfparser/blocks/simplex.cc:134
>> ]: Error in block SIMPLEX (line 1): Wrong number of
>> simplex parameters (got 0, expected 1) *
>> P.S: I also attached an example of the *.dgf file I am using.
>>
>> I need your help to figure out what I am doing wrong or what's the
>> problem with the first line of the *.dgf file simplex block, and how can I
>> potentially fix it?
>>
>> Thank you in advance,
>> Kenza
>>
>> ___
>> DuMux mailing list
>> DuMux@listserv.uni-stuttgart.de
>> https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
>>
>>
>
___
DuMux mailing list
DuMux@listserv.uni-stuttgart.de
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux