Git Product home page Git Product logo

Comments (3)

ahmadia avatar ahmadia commented on July 29, 2024

Notes from Manuel:

I have been working on this. First, I found the only available interpolations in PETSc are of zeroth and first order as one can see here [1]. I guess neither is good for post-computing purposes, but either is fine for plotting so I used zeroth order. This interpolation just allows a refinement factor of 2, see lines 410 and 411 of [2]. This is good enough for me and if not, I can do it a couple of times or more.

Anyway, the only real issue I found is that the number of processors used seems to determine if this is going to work or not. Let Mx and My be the number of grid cells in x and y respectively considering the coarse grid (this is PETSc notation) and np be the number of processors. Then Mx*My/np has to be an integer for the code not to crash, at least in my implementation (which is shown below).

I can work with this in the meantime (so no rush from my part Aron). Indeed, since I already did several heavy simulations, which I don't want to redo, I will just run a code that reads the finer solution, coarsen it and write it down in a different file. I guess that even for the following simulations, I will follow this approach since it may be better to have coarsen and non-coarsen outputs.

Implementation:
sol.state.q_da.setRefinementFactor(refine_x=2,refine_y=2) # This is the default
qda_coarsen = sol.state.q_da.coarsen()
gqVec_coarsen = qda_coarsen.createGlobalVec()
qda_coarsen.setInterpolationType(interp_type=0) # zeroth order, first is the default
mat,scale = qda_coarsen.getInterpolation(sol.state.q_da)
mat.multTranspose(sol.state.gqVec,gqVec_coarsen)
gqVec_coarsen = scale*gqVec_coarsen

then I do gqVec_coarsen.getArray().reshape(...), create a coarsen grid (x and y must be coarsen as well), coarsen state, coarsen solution and write this down using write_petsc()

references:
(1). http://www.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-current/docs/manualpages/DA/DASetInterpolationType.html
(2). http://www.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-current/src/dm/da/src/dainterp.c.html

from pyclaw.

ahmadia avatar ahmadia commented on July 29, 2024

Code exists for doing this in user-space, I'm still not sure this is something we want to roll into pyclaw as anything besides a demonstration in apps/

Should we add some of Manuel's code that does this into the apps/ directory, perhaps even as a test?

from pyclaw.

ketch avatar ketch commented on July 29, 2024

On Sun, Sep 30, 2012 at 4:10 AM, ahmadia [email protected] wrote:

Code exists for doing this in user-space, I'm still not sure this is
something we want to roll into pyclaw as anything besides a demonstration
in apps/

Should we add some of Manuel's code that does this into the apps/directory, perhaps even as a test?

Yes.


Reply to this email directly or view it on GitHubhttps://github.com//issues/38#issuecomment-9009816.

from pyclaw.

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.