Git Product home page Git Product logo

Comments (8)

mhvwerts avatar mhvwerts commented on June 20, 2024

Thinking about the inclusion of the information on boundary conditions inside the CellVariable object, I realized that it may be an idea to have the boundary conditions fully handled by the CellVariable object: creation of BoundaryConditions object stored inside the CellVariable structure, definition of the a, b, c etc., pre-calculation/updating of the BoundaryConditionsTerm matrix + RHS etc. etc.

This would lead to a more logical workflow, where first the cell variable is created, followed by definition of the boundary conditions if required (only solution variables need boundary conditions).

I think that such a solution may even be implemented without breaking the existing infrastructure.

from pyfvtool.

mhvwerts avatar mhvwerts commented on June 20, 2024

Concerning CellVariable.bc_to_ghost() and CellVariable.BC2GhostCells() (cell.py), these have perhaps been superseded by cellValuesWithBoundaries (boundary.py)? It seems to serve a similar function, and does indeed take into account the defined boundary conditions when assigning values to the ghost cells.

from pyfvtool.

simulkade avatar simulkade commented on June 20, 2024

Concerning CellVariable.bc_to_ghost() and CellVariable.BC2GhostCells() (cell.py), these have perhaps been superseded by cellValuesWithBoundaries (boundary.py)? It seems to serve a similar function, and does indeed take into account the defined boundary conditions when assigning values to the ghost cells.

Indeed, it is the case. In the development sprint, I replaced some of the old functions with more +at least in my head+ logical ones. This is one of those cases.

This would lead to a more logical workflow, where first the cell variable is created, followed by definition of the boundary conditions if required (only solution variables need boundary conditions).

I totally agree. I cannot remember any use cases that a boundary exist without a CellVariable (well, for steady-state problems we have the BC before having the CellVariable but later the solution will be a cell variable).

from pyfvtool.

simulkade avatar simulkade commented on June 20, 2024

[2] Should we use consistent naming: use either the term 'boundary cells', or the term 'ghost cells' exclusively? Perhaps I am missing a subtlety here? Boundary cell is perhaps ambiguous: it may refer to the ghost cell or to the outermost inner cell?

I am in favor of ghost cells.

from pyfvtool.

mhvwerts avatar mhvwerts commented on June 20, 2024

[2] Should we use consistent naming: use either the term 'boundary cells', or the term 'ghost cells' exclusively? Perhaps I am missing a subtlety here? Boundary cell is perhaps ambiguous: it may refer to the ghost cell or to the outermost inner cell?

I am in favor of ghost cells.

So am I.

from pyfvtool.

simulkade avatar simulkade commented on June 20, 2024

The CellVariable.init() code requires some further cleaning up I think

What I prefer to do is to initialize the CellVariable with a boundary condition (Neumann) and later adjust the values of the -infamous- a, b, c. It is the workflow that we have more or less in all examples. We can at some point write some utility functions to do the adjustment in more pythonic ways, e.g. by accepting dictionaries; for example:

BC = {
    "left": {"type": "Dirichlet", "value": 0.0},
    "right": {"type": "Neumann", "value": 0.0},
}

from pyfvtool.

mhvwerts avatar mhvwerts commented on June 20, 2024

I agree.

I have a relatively simple plan for embedding the boundary condition structure in the CellVariable, creating it if it is not supplied externally. It will be initialized with default "no flux" (Neumann) values. Then, it can be fine-tuned via the usual left right etc. a, b, c mechanism. Finally, we call a method which we may name apply_BCs that re-calculates the ghost cell values (via cellValuesWithBoundaries) and even pre-calculates the BoundaryConditionsTerms M and RHS.

This could later be embellished in more pythonic ways, as you suggest.

from pyfvtool.

simulkade avatar simulkade commented on June 20, 2024

I agree.

I have a relatively simple plan for embedding the boundary condition structure in the CellVariable, creating it if it is not supplied externally. It will be initialized with default "no flux" (Neumann) values. Then, it can be fine-tuned via the usual left right etc. a, b, c mechanism. Finally, we call a method which we may name apply_BCs that re-calculates the ghost cell values (via cellValuesWithBoundaries) and even pre-calculates the BoundaryConditionsTerms M and RHS.

This could later be embellished in more pythonic ways, as you suggest.

Love the idea! Simple and elegant.

from pyfvtool.

Related Issues (14)

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.