Hi Georg,

the piece of code looks fine to me. Assuming that it really is, the problem has to be outside:

- the value of anodeChannelGDLInterface_ might be wrong

- the mdGrid does not contain the upper and lower parts

Kind regards
Bernd

On 05/28/2015 10:13 AM, georg.fut...@dlr.de wrote:

Hello DuMuXers,

The grid geometry I want to create is attached as .jpg-file. I want to create a sub domain Omega1 as depicted. Here is my code from the coupled problem:

    void initializeGrid()

    {

        MDGrid& mdGrid = this->mdGrid();

        mdGrid.startSubDomainMarking();

        // subdivide grid into three subdomains

        ElementIterator eendit = mdGrid.template leafend<0>();

        for (ElementIterator elementIt = mdGrid.template leafbegin<0>();

             elementIt != eendit; ++elementIt)

        {

            // this is required for parallelization

            // checks if element is within a partition

            if (elementIt->partitionType() != Dune::InteriorEntity)

                continue;

            GlobalPosition globalPos = elementIt->geometry().center();

            if (globalPos[0] < interface12_)

            {

if(globalPos[0] < anodeChannelGDLInterface_) // add everything

mdGrid.addToSubDomain(anode_,*elementIt);

                else

if(globalPos[1] < noPEMUpper_ && globalPos[1] > noPEMLower_) // add only the middle part

mdGrid.addToSubDomain(anode_,*elementIt);

            }

            else{

                if (globalPos[0] > interface23_)

mdGrid.addToSubDomain(cathode_,*elementIt);

                else

                {

if (globalPos[1] < noPEMUpper_ && globalPos[1] > noPEMLower_)

mdGrid.addToSubDomain(pem_,*elementIt);

                }

            }

        }

        mdGrid.preUpdateSubDomains();

        mdGrid.updateSubDomains();

        mdGrid.postUpdateSubDomains();

        gridinfo(this->sdGrid1());

        gridinfo(this->sdGrid2());

        gridinfo(this->sdGrid3());

    }

What I obtain is a rectangular Omega1 bounded by noPEMUpper_, noPEMLower_ and interface12_. The upper and lower part left of anodeChannelGDLInterface_ are not part of the grid. Anyone has a clue why this is not working?

Best regards

Georg Futter

——————————————————————————

*German Aerospace Center *(DLR)

Institute of Engineering Thermodynamics | Computational Electrochemistry | Pfaffenwaldring 38-40 | 70569 Stuttgart

Dipl.-Ing. *Georg Futter* | Ph.D. student

Telefon 0711/6862-8135 | georg.fut...@dlr.de <mailto:georg.fut...@dlr.de>

www.DLR.de <http://www.dlr.de/>



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


--
_______________________________________________________________

Bernd Flemisch                         phone: +49 711 685 69162
IWS, Universität Stuttgart             fax:   +49 711 685 60430
Pfaffenwaldring 61            email: be...@iws.uni-stuttgart.de
D-70569 Stuttgart            url: www.hydrosys.uni-stuttgart.de
_______________________________________________________________

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

Reply via email to