Hi Lorenzo,

you can do so by obtaining the global coordinates of your degree of freedom via 
the sub-control volume, e.g.:


const auto pos = fvGeometry.subContVol[scvIdx].global;


pos is a container with the coordinates. Now you can define your own function 
depending on x and y by using pos[0] and pos[1].


I hope this helps!


Best wishes,
Dennis


________________________________
Von: Dumux <dumux-boun...@listserv.uni-stuttgart.de> im Auftrag von Gläser, 
Dennis <dennis.glae...@iws.uni-stuttgart.de>
Gesendet: Freitag, 19. Oktober 2018 12:55:25
An: dumux@listserv.uni-stuttgart.de
Betreff: Re: [DuMuX] initial value dependent on x and y domain coordinate


Hi Lorenzo,

you can do so by obtaining the global coordinates of your degree of freedom via 
the sub-control volume, e.g.:


const auto pos = fvGeometry.subContVol[scvIdx].global;


pos is a container with the coordinates. Now you can define your own function 
depending on x and y by using pos[0] and pos[1].


I hope this helps!


Best wishes,
Dennis


________________________________
Von: Dumux <dumux-boun...@listserv.uni-stuttgart.de> im Auftrag von lc 
<lorenzo.camp...@uniroma1.it>
Gesendet: Freitag, 19. Oktober 2018 12:45:32
An: dumux@listserv.uni-stuttgart.de
Betreff: [DuMuX] initial value dependent on x and y domain coordinate


Dear developers and users,

thanks for your fast and appropriate.

Once again I have a doubt. How can I apply an initial condition (for example on 
saturation profile) which depends on the x and y spatial coordinates of the 
domain?

//! Evaluates the initial value for a control volume. For this
    //! method, the 'values' parameter stores primary variables.
    void initial(PrimaryVariables &values,
                 const Element &element,
                 const FVElementGeometry &fvGeometry,
                 int scvIdx) const
    {
        values[Indices::pwIdx] =200 kPa = 2 bar
        values[Indices::snIdx] = should go here ...
    }

Kind regards,

Lorenzo
_______________________________________________
Dumux mailing list
Dumux@listserv.uni-stuttgart.de
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to