GithubHelp home page GithubHelp logo

Comments (4)

vcantarella avatar vcantarella commented on June 14, 2024

Looking at the source code of the function I think the problem is in this snippet:

    # fill flow terms
    vmult = [-1.0, -1.0, -1.0]
    flows = [frf, fff, flf]
    for n in range(grb.nodes):
        i0, i1 = ia[n] + 1, ia[n + 1]
        for j in range(i0, i1):
            jcol = ja[j]
            if jcol > n:
                if jcol == n + 1:
                    ipos = 0
                elif jcol == n + grb.ncol: # <======HERE
                    ipos = 1
                else:
                    ipos = 2
                flows[ipos][n] = vmult[ipos] * flowja[j]
    return frf.reshape(shape), fff.reshape(shape), flf.reshape(shape)

It seems like it already assumes that jcol == n+grb.ncol means it is in the next row, but in this case it should jump straight to the next layer.

from flopy.

langevin-usgs avatar langevin-usgs commented on June 14, 2024

Thanks for picking this up @w-bonelli. I looked at this a bit and it should be easy to fix, but it is trickier than it seems. Curious to see what you come up with.

from flopy.

jdhughes-usgs avatar jdhughes-usgs commented on June 14, 2024

@w-bonelli we have run into edge case issues with function before. It seems we should have better testing for this. Probably need cases (1, nrow, 1), (1, 1, ncol), (1, nrow, ncol), (2, nrow, 1), (2, 1, ncol), (2, nrow, ncol), (3, nrow, 1), (3, 1, ncol), and (3, nrow, ncol) to cover all bases.

from flopy.

wpbonelli avatar wpbonelli commented on June 14, 2024

Changes were needed to the way we determine which face each flow belongs to, while iterating through the intercell flow matrix to build right/front/lower face arrays.

In the given model, flows with m - n == ncol go to lower face as noted by @vcantarella. Previously the logic was

  • 0 (right) if m - n == 1
  • 1 (front) if m - n == ncol
  • 2 (lower) otherwise

With #1968 it becomes

  • 0 (right) if m - n == 1
  • 2 (lower) if m - n == ncpl
  • 1 (front) otherwise

But this is not generic, it only works if the grid is extended (has multiple cells) in all 3 dimensions. Special treatment is added for "degenerate" cases among those listed above by @jdhughes-usgs

from flopy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.