Options

Introduction

Thanks for the friendly welcome John.

I'm a non-academic, self-taught computer programmer with interests in:


information theory, bayesian and maxent methods
functional thinking and programming (haskell)
program correctness (Z, CSP, learning CASL, proof tools)
linear programming


Unfortunately I had 6 years experience programming large websites in java. I also used to be a journalist so good documentation and literate programming have always been my way.

I've started going through the azimuth documentation to find out what's what.

I haven't had the mileage to keep up with my favourite climate source ie. realclimate.org since the U. E. Anglia CRU hacking but I did skim some of their Fortran. I'll have to try and find the model name and downloaded code again but what was I noticed were the painful efforts at documentation by the CRU's main programmer. Iirc "which data set is this code matched with?" seemed to be the main kind of comment. Data validation and verification problems obviously figure largely in the current state of the field.

At the moment I'm assembling some programmed learning software and have tried some toy programming in what is known as functional reactive animation, happily now having the time to get back to CAD programming after 20 years.

I have very ugly placeholder website with a friend's very good 3D Studio Max animations at stuttard.org.

I look forward to receiving any suggestions for needed contributions to azimuth code or anything else.

Cheers

Comments

  • 1.

    Hi and welcome!

    Unfortunately I had 6 years experience programming large websites in java.

    What's so bad about that? I spend the last 4 months as a consultant at BMW for a web project based on Java - there are worse jobs in the IT industry, believe me.

    I look forward to receiving any suggestions for needed contributions to azimuth code or anything else.

    I try to specialize in climate science, although there are a lot of other interesting topics that Azimuth is about, for example smart grids, which offer a lot of programming tasks too.

    But if you are interested in climate science, I'd say that, basically, there are these possible lines of attack:

    A) analyse existing climate models: Lots and lots of code, mostly in obscure FORTRAN, bad documentation etc. A necessary task however, because computer models are an indispensable tool in climate science (because we can't do many lab experiments) and they suffer from a severe lack in credibility (in some discussions it seems to be enough to say "all that climate alarmists have are computer models!").

    There are several reasons why I haven't been more active in this area: I realized that I have a lot to learn about climate and climate modelling first before I can dive into the code. So, this leads us to

    B) Do some toy problems related to climate modelling so that the results can be shown and played with on the web. Still on my to do list is an implementation of a spectral method approximation to the Burgers equation. I think that we should try to use Sage as a platform. I don't know how one could write extensions to Sage in C++, but I think that this will become necessary once we go from the simplest toy models to some more serious applications, like turbulence in a cube.

    C) Do some statistical analysis of time series: Recently I have noticed that some people doubt the IPCC analysis of the temperature time series, although it should be very easy to do some tests. This is really a kindergarten topic if you know a little bit about the topic, but I haven't found anyone who has done this and published it on the web. And I think that sceptics who doubt the IPCC analysis deserve an answer, even if it is easy and uninteresting to come by.

    Comment Source:Hi and welcome! <blockquote> <p> Unfortunately I had 6 years experience programming large websites in java. </p> </blockquote> What's so bad about that? I spend the last 4 months as a consultant at BMW for a web project based on Java - there are worse jobs in the IT industry, believe me. <blockquote> <p> I look forward to receiving any suggestions for needed contributions to azimuth code or anything else. </p> </blockquote> I try to specialize in climate science, although there are a lot of other interesting topics that Azimuth is about, for example smart grids, which offer a lot of programming tasks too. But if you are interested in climate science, I'd say that, basically, there are these possible lines of attack: A) analyse existing climate models: Lots and lots of code, mostly in obscure FORTRAN, bad documentation etc. A necessary task however, because computer models are an indispensable tool in climate science (because we can't do many lab experiments) and they suffer from a severe lack in credibility (in some discussions it seems to be enough to say "all that climate alarmists have are computer models!"). There are several reasons why I haven't been more active in this area: I realized that I have a lot to learn about climate and climate modelling first before I can dive into the code. So, this leads us to B) Do some toy problems related to climate modelling so that the results can be shown and played with on the web. Still on my to do list is an implementation of a [[spectral method]] approximation to the [[Burgers equation]]. I think that we should try to use [[Sage]] as a platform. I don't know how one could write extensions to Sage in C++, but I think that this will become necessary once we go from the simplest toy models to some more serious applications, like turbulence in a cube. C) Do some statistical analysis of time series: Recently I have noticed that some people doubt the IPCC analysis of the temperature time series, although it should be very easy to do some tests. This is really a kindergarten topic if you know a little bit about the topic, but I haven't found anyone who has done this and published it on the web. And I think that sceptics who doubt the IPCC analysis deserve an answer, even if it is easy and uninteresting to come by.
  • 2.

    Welcome Jim ! I'd say get a look at the level of learning Python and Sage - look at the latter as Sage is programmed in Python, which is a has some basic functional programming and OO concepts and no need for patterns as its dynamically typed- well except "delegation" maybe.

    One way is if we can think of a way to use Linear Programming which is supported by Sage and also maybe adding a tutorial on that here on Sage - I can help you get started if you want?

    Im going to add a tutorial on Graphs in Sage pretty soon, and I will add some box models as separate pages, eg the carbon cycle and maybe one oceans, For me this is a good way of learning the earth and climate sciences. Then I usually hook up to model some more complex model in sage with others like we did with snowball earth.

    Comment Source:Welcome Jim ! I'd say get a look at the level of learning [[Python]] and [[Sage]] - look at the latter as Sage is programmed in Python, which is a has some basic functional programming and OO concepts and no need for patterns as its dynamically typed- well except "delegation" maybe. One way is if we can think of a way to use Linear Programming which is supported by Sage and also maybe adding a tutorial on that here on Sage - I can help you get started if you want? Im going to add a tutorial on Graphs in Sage pretty soon, and I will add some [[box models]] as separate pages, eg the [[carbon cycle]] and maybe one [[oceans]], For me this is a good way of learning the earth and climate sciences. Then I usually hook up to model some more complex model in sage with others like we did with [[snowball earth]].
  • 3.

    Welcome Jim!

    Unfortunately I had 6 years experience programming large websites in java.

    Now I'm quite curious why unfortunately?

    Me, never done any Java. But I did some web client-server with PHP/mod_perl resp. Javascript, tons of Javascript actually. Never felt the need of using Java. Meanwhile I've once again given up on computers and will perhaps come back once again in some years.

    Comment Source:Welcome Jim! > Unfortunately I had 6 years experience programming large websites in java. Now I'm quite curious why unfortunately? Me, never done any Java. But I did some web client-server with PHP/mod_perl resp. Javascript, tons of Javascript actually. Never felt the need of using Java. Meanwhile I've once again given up on computers and will perhaps come back once again in some years.
  • 4.
    edited August 2011

    Oh (now back home from work)... The above shall not in the slightest indicate that I am not interested in the Azimuth softwary pursuits! I intentionally keep my configured and compiled Fvwm Linux desktop (as opposed to today's n-peephole (n=1 with microsofts) "windowing" systems) laptop (one of the most grotesque machines at booting: Every 2nd boot put out the battery, so it forgets about being in no-lamp mode (a paradigmatic exemplar of engineering failure by adding superfluous stuff: Here it's the bit representing no-lamp mode)) offline. (Plus, it has the latest Debian Linux with it's super quick boot disabled by the lack of a DHCP server for which it waits and waits (which is just one grotesque exemplar of non-internets incapability (which in my judgement is equivalent to insufficient internets capability) in my collection of pathologies...))... But if I had the slightest shred of time, I would carry the Sage stuff plus data files to that perhaps sad (but classic and for me IT cynic just too funny) exemplar of computer, rest assured.


    Typed at mom's microsofts with no syntax highlighting standard editor in sight. Brackets not verified.

    Comment Source:Oh (now back home from work)... The above shall not in the slightest indicate that I am not interested in the Azimuth softwary pursuits! I intentionally keep my configured and compiled Fvwm Linux desktop (as opposed to today's n-peephole (n=1 with microsofts) "windowing" systems) laptop (one of the most grotesque machines at booting: Every 2nd boot put out the battery, so it forgets about being in no-lamp mode (a paradigmatic exemplar of _engineering failure by adding superfluous stuff_: Here it's the bit representing no-lamp mode)) **offline**. (Plus, it has the latest Debian Linux with it's super quick boot disabled by the lack of a DHCP server for which it waits and waits (which is just one grotesque exemplar of _non-internets incapability_ (which in my judgement is equivalent to insufficient internets capability) in my collection of pathologies...))... **But** if I had the slightest shred of time, I would carry the Sage stuff plus data files to that perhaps sad (but classic and for me IT cynic just too funny) exemplar of computer, rest assured. ----- Typed at mom's microsofts with no syntax highlighting standard editor in sight. Brackets not verified.
  • 5.
    edited August 2011

    So, quickly hijacking this thread for another bit of my own introduction. I am indeed sort of a computer Frankenstein. It started long before I got Florifundator (christened by Glorionestus Vastarius von Teisenberg upon a poem I wrote about spelling "Gisser") and now incarnate as his avatāra, Florifulgurator. I ended up with a theoretically UNIX capable self-made machine plugged into a TRS-80 derivate as terminal: 4MHz 68000 CPU fed with 8-KByte eproms baked in a wiry contraption (and later erased in that spooky chest with a dead cat painted on it and dangerous UV tubes inside) 16KByte RAM on batteries (board self-destroyed in full memory 4 years later). It is quite possibly my first and only serious computer. (Much later I learnt that at that time (and 100km away) Andreas Grimm built the dream variant of an early 68000 machine - used for the control of a machine that shakes and vibrates tons of concrete with a space satellite dummy mounted on it... oh dreams of maths and engineering). I added a TMS320 digital sound machine (first TMS320 with a bug in the multiplication table, perhaps still in my cabinet)) with 128KByte self-wired and flipfloppified DRAM sound memory, which was fun to watch fade away at the hex editor (I wired a refresh disable switch). That was during school. Then spending my compulsory German army year playing (theoreticly nuclear, 30km) field artillery survey and calibration without laser and GPS (we still outperformed the U.S., who were sporting the first GPS dishes at Grafenwöhr) and thinking about stupid people (with or without buttons, guns or tools) Florifundator decided to why not study math... And indeed, meantime the squared worst case engineering evolution of the x86 (Intel's 8080 CPU painfully continuo-engineered to not jump the 32 bit as long as possible) dinosaur multiplied with Bill Gates' eternal genius (why not square messy hardware with messy software?) unfolded. Luckily the world was full of other interesting things.

    Comment Source:So, quickly hijacking this thread for another bit of my own introduction. I am indeed sort of a computer Frankenstein. It started long before I got Florifundator (christened by Glorionestus Vastarius von Teisenberg upon a poem I wrote about spelling "Gisser") and now incarnate as his avatāra, Florifulgurator. I ended up with a theoretically UNIX capable self-made machine plugged into a TRS-80 derivate as terminal: 4MHz 68000 CPU fed with 8-KByte eproms baked in a wiry contraption (and later erased in that spooky chest with a dead cat painted on it and dangerous UV tubes inside) 16KByte RAM on batteries (board self-destroyed in full memory 4 years later). It is quite possibly my first and _only serious computer_. (Much later I learnt that at that time (and 100km away) Andreas Grimm built the dream variant of an early 68000 machine - used for the control of a machine that shakes and vibrates tons of concrete with a space satellite dummy mounted on it... _oh dreams of maths and engineering_). I added a TMS320 digital sound machine (first TMS320 with a bug in the multiplication table, perhaps still in my cabinet)) with 128KByte self-wired and flipfloppified DRAM sound memory, which was fun to watch fade away at the hex editor (I wired a refresh disable switch). That was during school. Then spending my compulsory German army year playing (theoreticly nuclear, 30km) field artillery survey and calibration without laser and GPS (we still outperformed the U.S., who were sporting the first GPS dishes at Grafenwöhr) and thinking about stupid people (with or without buttons, guns or tools) Florifundator decided to _why not study math_... And indeed, meantime the _squared worst case_ engineering evolution of the x86 (Intel's 8080 CPU painfully continuo-engineered to not jump the 32 bit as long as possible) dinosaur multiplied with Bill Gates' eternal genius (why not square messy hardware with messy software?) unfolded. _Luckily the world was full of other interesting things._
  • 6.
    Hi Tim, Steffan and Martin,

    Thanks for the warm welcomes.

    I've started on the literate 2/3 of some burger hierarchy toy programs. Do you have a minimal test data set?

    As for imperative languages: the next generation of mobile phones will probably have multicore cpus. This demands FP without side-effects as explained in John Hughes's Why Functional Programming Matters (1984).
    Comment Source:Hi Tim, Steffan and Martin, Thanks for the warm welcomes. I've started on the literate 2/3 of some burger hierarchy toy programs. Do you have a minimal test data set? As for imperative languages: the next generation of mobile phones will probably have multicore cpus. This demands FP without side-effects as explained in John Hughes's Why Functional Programming Matters (1984).
  • 7.
    John Hughes paper http://bit.ly/rmSh2g
    Comment Source:John Hughes paper http://bit.ly/rmSh2g
  • 8.

    Jim wrote:

    I've started on the literate 2/3 of some burger hierarchy toy programs. Do you have a minimal test data set?

    I'm not sure I understand what you mean when you say "test data set". The idea behind the Burgers equation is this:

    • for a global climate model we need to solve an approximate form of the Navier-Stokes equations both for the atmosphere and the oceans,

    • as an interesting intermediate excercise one could try to simulate turbulent flow in a cube with periodic boundary condition, which is an interesting research project of its own,

    • as an introductory excercise one could try to solve the simplest nonlinear PDE that exhibits turbulence, the Burgers equation, on an 1D interval with periodic boundary conditions.

    And this solution should be done with a method that is also used in climate models, namely a spectral method. In order to get an idea of how good the approximation is, we should also have a solution in closed form. This solution happens to be known for the Burgers equation, I wrote about it in the paragraph with the title "An Exact Solution of a Boundary Value Problem" (and about the spectral approximation in the paragraph "Approximation via Fourier-Galerkin Spectral Method").

    So, this excercise is about an implementation of both the spectral method approximation and comparing that to the closed form solution.

    Comment Source:Jim wrote: <blockquote> <p> I've started on the literate 2/3 of some burger hierarchy toy programs. Do you have a minimal test data set? </p> </blockquote> I'm not sure I understand what you mean when you say "test data set". The idea behind the [[Burgers equation]] is this: - for a global climate model we need to solve an approximate form of the Navier-Stokes equations both for the atmosphere and the oceans, - as an interesting intermediate excercise one could try to simulate turbulent flow in a cube with periodic boundary condition, which is an interesting research project of its own, - as an introductory excercise one could try to solve the simplest nonlinear PDE that exhibits turbulence, the Burgers equation, on an 1D interval with periodic boundary conditions. And this solution should be done with a method that is also used in climate models, namely a [[spectral method]]. In order to get an idea of how good the approximation is, we should also have a solution in closed form. This solution happens to be known for the [[Burgers equation]], I wrote about it in the paragraph with the title "An Exact Solution of a Boundary Value Problem" (and about the spectral approximation in the paragraph "Approximation via Fourier-Galerkin Spectral Method"). So, this excercise is about an implementation of both the spectral method approximation and comparing that to the closed form solution.
  • 9.
    Woo, running the literate code from Rafael S. Calsaverini's blog in ghci. Stochastic Processes as Monad Transformers http://bit.ly/aPzKDA with a nice explanation.
    Comment Source:Woo, running the literate code from Rafael S. Calsaverini's blog in ghci. Stochastic Processes as Monad Transformers http://bit.ly/aPzKDA with a nice explanation.
  • 10.
    Help needed. I keep getting "there was a problem in (adding your post)". Any suggestions?
    Comment Source:Help needed. I keep getting "there was a problem in (adding your post)". Any suggestions?
  • 11.

    Sometimes I experience a hickup of this sort, too: I usually reload the page and copy&paste my post into an empty input area, which has always worked.

    Woo, running the literate code from Rafael S. Calsaverini's blog in ghci. Stochastic Processes as Monad Transformers http://bit.ly/aPzKDA with a nice explanation.

    So, you are not interested in the Burgers equation but in how stochastic processes can be simulated in Haskell?

    Comment Source:Sometimes I experience a hickup of this sort, too: I usually reload the page and copy&paste my post into an empty input area, which has always worked. <blockquote> <p> Woo, running the literate code from Rafael S. Calsaverini's blog in ghci. Stochastic Processes as Monad Transformers http://bit.ly/aPzKDA with a nice explanation. </p> </blockquote> So, you are not interested in the Burgers equation but in how stochastic processes can be simulated in Haskell?
  • 12.
    edited August 2011

    Yea, I just redid the post and that worked.

    So, you are not interested in the Burgers equation but in how stochastic processes can be simulated in Haskell?

    I'm interested in anything which helps combat global warming. I have just making made a start at learning by coding the simplest relevant problems I can cope with.

    So far I've read one of the half a dozen or so burger papers I've just downloaded.

    I start thinking about specs by considering which categorical beasts might be appropriate to the problem. The beasts I use are already coded in haskell-category-extras and many other packages written by Ed Kmett.

    I take a language-independent, formal methods approach to specification and I like multilanguage verifications of experimental code. My choice of haskell also means I can animate toy programs in the Hood debugger to show recursive steps for other learners.

    Any ideas wrt spectral method and burger test data? The code I downloaded as BurgerTX.f has 41 input parameters so some simplifications needed for a start.

    If I can get anything working I'll happily port it to whatever platform you want.

    HTH

    Comment Source:Yea, I just redid the post and that worked. > So, you are not interested in the Burgers equation but in how stochastic processes can be simulated in Haskell? I'm interested in anything which helps combat global warming. I have just making made a start at learning by coding the simplest relevant problems I can cope with. So far I've read one of the half a dozen or so burger papers I've just downloaded. I start thinking about specs by considering which categorical beasts might be appropriate to the problem. The beasts I use are already coded in haskell-category-extras and many other packages written by Ed Kmett. I take a language-independent, formal methods approach to specification and I like multilanguage verifications of experimental code. My choice of haskell also means I can animate toy programs in the Hood debugger to show recursive steps for other learners. Any ideas wrt spectral method and burger test data? The code I downloaded as BurgerTX.f has 41 input parameters so some simplifications needed for a start. If I can get anything working I'll happily port it to whatever platform you want. HTH
  • 13.
    edited August 2011

    I can edit a post but not delete the contents it seems ;)

    Comment Source:I can edit a post but not delete the contents it seems ;)
  • 14.
    edited August 2011

    Hi, Jim! It's great to see you here, chatting away with all the computer guys!

    It looks like you've re-energized the Burgers equation project - that's great! If you guys do anything interesting regarding this equation (and my standards are extremely low), I'll blog about it - starting with the stuff Eric Forgy has already done.

    By the way, Jim, I believe you can edit your comments here by clicking the blue word "edit" which appears near the top of each comment. At least I can edit your comments - but I have magical superpowers, being the boss. I'll change "4 input params" to "41 input params", to prove it. But I believe you could do it too, at least for your own posts.

    Comment Source:Hi, Jim! It's great to see you here, chatting away with all the computer guys! It looks like you've re-energized the Burgers equation project - that's great! If you guys do anything interesting regarding this equation (and my standards are extremely low), I'll blog about it - starting with the stuff Eric Forgy has already done. By the way, Jim, I believe you can edit your comments here by clicking the blue word "edit" which appears near the top of each comment. At least _I_ can edit your comments - but I have magical superpowers, being the boss. I'll change "4 input params" to "41 input params", to prove it. But I believe you could do it too, at least for your _own_ posts.
  • 15.

    Hi Tim. I've only just seen your excellent post. Thanks for the very clear explanation here and on the wiki. I've read the appropriate pages but as it's 20 years since I read one book on variational calculus for FEM - it all might as well be completely new to me. I'm glad I appear to have made the correct choice in starting to learn and code the 1d solution using one or other of two fft codes I have :)

    Comment Source:Hi Tim. I've only just seen your excellent post. Thanks for the very clear explanation here and on the wiki. I've read the appropriate pages but as it's 20 years since I read one book on variational calculus for FEM - it all might as well be completely new to me. I'm glad I appear to have made the correct choice in starting to learn and code the 1d solution using one or other of two fft codes I have :)
  • 16.

    Jim wrote:

    I've only just seen your excellent post.

    Glad you like it :-)

    as it's 20 years since I read one book on variational calculus for FEM - it all might as well be completely new to me.

    I started to write about spectral methods on the Azimuth wiki for pure mathematicians - for people who implement the numerical algorithms a deep understanding of variational calculus is usually not necessary.

    The code I downloaded as BurgerTX.f has 41 input parameters so some simplifications needed for a start.

    Oh, where did you get that from? Did you already mention the link? What are the input parameters?

    The toy problem is in one dimension, on the interval $[0, \pi]$ with periodic boundary conditions (or on $S^1$, depending on your taste), with a special initial condition

    $$ u(x, 0) = u_0 \sin(\frac{\pi x}{l}) $$ Is your code capable to approximate this?

    Comment Source:Jim wrote: <blockquote> <p> I've only just seen your excellent post. </p> </blockquote> Glad you like it :-) <blockquote> <p> as it's 20 years since I read one book on variational calculus for FEM - it all might as well be completely new to me. </p> </blockquote> I started to write about spectral methods on the Azimuth wiki for pure mathematicians - for people who implement the numerical algorithms a deep understanding of variational calculus is usually not necessary. <blockquote> <p> The code I downloaded as BurgerTX.f has 41 input parameters so some simplifications needed for a start. </p> </blockquote> Oh, where did you get that from? Did you already mention the link? What are the input parameters? The toy problem is in one dimension, on the interval $[0, \pi]$ with periodic boundary conditions (or on $S^1$, depending on your taste), with a special initial condition $$ u(x, 0) = u_0 \sin(\frac{\pi x}{l}) $$ Is your code capable to approximate this?
  • 17.
    edited August 2011

    Hi Steffan,

    Sorry it's taken so long to reply to your kind offer of help. At the moment I'm trying to compile Jeff Foster's "Barely Functional Fluid Dynamics" code (2D solutions and already instrumented with graphics, unit tests and performance stats):). src: http://bit.ly/qciXtC. It is "barely functional" as it's a direct imperative C translation. Perhaps we can find a better way later? :)

    I've looked at the Sage page and look forward to reading your tutorial. I didn't realise you'd mentioned it but serendipitously I was going to ask how to post graphs on this page?

    Cheers

    Comment Source:Hi Steffan, Sorry it's taken so long to reply to your kind offer of help. At the moment I'm trying to compile Jeff Foster's "Barely Functional Fluid Dynamics" code (2D solutions and already instrumented with graphics, unit tests and performance stats):). src: http://bit.ly/qciXtC. It is "barely functional" as it's a direct imperative C translation. Perhaps we can find a better way later? :) I've looked at the Sage page and look forward to reading your tutorial. I didn't realise you'd mentioned it but serendipitously I was going to ask how to post graphs on this page? Cheers
  • 18.

    Morning Tim,

    BurgerTX.f is downloadable from http://people.bu.edu/robinc/kzk. As a great lazy bricoleur I haven't written a line of code yet, only a list of buzzword candidate types but Fatvat (see bit.ly above ) has already given me some ready-made 2D solutions. I'm in the middle of a (failing) compiler upgrade ATM but will try and code your variant shortly.

    Cheers

    Comment Source:Morning Tim, BurgerTX.f is downloadable from http://people.bu.edu/robinc/kzk. As a great lazy bricoleur I haven't written a line of code yet, only a list of buzzword candidate types but Fatvat (see bit.ly above ) has already given me some ready-made 2D solutions. I'm in the middle of a (failing) compiler upgrade ATM but will try and code your variant shortly. Cheers
  • 19.

    Stephan

    realclimate.org's Data Sources page has CliMt and pyclimate python toolsets you might be interested in.

    Comment Source:Stephan realclimate.org's Data Sources page has CliMt and pyclimate python toolsets you might be interested in.
  • 20.
    edited August 2011

    We can do this so far:

    *MFluid> :browse
    type DVector = Data.Vector.Unboxed.Base.IOVector Double
    data Grid = Grid Int DVector
    emptyGrid :: Int -> IO Grid
    ix :: Int -> (Int, Int) -> Int
    writeVal :: Grid -> (Int, Int) -> Double -> IO ()
    setVals :: Grid -> [((Int, Int), Double)] -> IO ()
    readVal :: Grid -> (Int, Int) -> IO Double
    addSource :: Grid -> Grid -> Double -> IO ()
    setBnd :: Int -> Grid -> IO ()
    forEachPixel :: Grid -> ((Int, Int) -> IO ()) -> IO ()
    neighbours ::
      Grid -> (Int, Int) -> IO (Double, Double, Double, Double)
    linSolveStep :: Int -> Grid -> Grid -> Double -> Double -> IO ()
    linSolve :: Int -> Grid -> Grid -> Double -> Double -> IO ()
    diffuse :: Int -> Grid -> Grid -> Double -> Double -> IO ()
    advect :: Int -> Grid -> Grid -> Grid -> Grid -> Double -> IO ()
    project :: Grid -> Grid -> Grid -> Grid -> IO ()
    densStep ::
      Grid -> Grid -> Grid -> Grid -> Double -> Double -> IO ()
    velStep ::
      Grid -> Grid -> Grid -> Grid -> Double -> Double -> IO ()
    vecToList :: DVector -> IO [Double]
    absDifference :: [Double] -> [Double] -> Double
    nearlyEqual :: [Double] -> [Double] -> Bool
    gridToList :: Grid -> IO [Double]
    vectorLength :: Int -> Int
    listToVec :: [Double] -> IO DVector
    zeroGrid :: Grid -> IO ()
    swap :: Grid -> Grid -> IO ()
    testSetBnd :: IO ()
    testLinSolveStep :: IO ()
    testLinSolve :: IO ()
    testAdvect :: IO ()
    testProject :: IO ()
    testVelStep :: IO ()
    main :: IO (Maybe a)
    tests :: IO ()
    *MFluid> tests
    Loading package primitive-0.3.1 ... linking ... done.
    Loading package vector-0.7.1 ... linking ... done.
    Testing setBnd
    True
    Testing LinSolveStep
    True
    Testing LinSolve
    True
    Testing advect
    True
    Testing project
    True
    VelStep testing
    True
    *MFluid>
    
    
    Comment Source:We can do this so far: <pre> *MFluid> :browse type DVector = Data.Vector.Unboxed.Base.IOVector Double data Grid = Grid Int DVector emptyGrid :: Int -> IO Grid ix :: Int -> (Int, Int) -> Int writeVal :: Grid -> (Int, Int) -> Double -> IO () setVals :: Grid -> [((Int, Int), Double)] -> IO () readVal :: Grid -> (Int, Int) -> IO Double addSource :: Grid -> Grid -> Double -> IO () setBnd :: Int -> Grid -> IO () forEachPixel :: Grid -> ((Int, Int) -> IO ()) -> IO () neighbours :: Grid -> (Int, Int) -> IO (Double, Double, Double, Double) linSolveStep :: Int -> Grid -> Grid -> Double -> Double -> IO () linSolve :: Int -> Grid -> Grid -> Double -> Double -> IO () diffuse :: Int -> Grid -> Grid -> Double -> Double -> IO () advect :: Int -> Grid -> Grid -> Grid -> Grid -> Double -> IO () project :: Grid -> Grid -> Grid -> Grid -> IO () densStep :: Grid -> Grid -> Grid -> Grid -> Double -> Double -> IO () velStep :: Grid -> Grid -> Grid -> Grid -> Double -> Double -> IO () vecToList :: DVector -> IO [Double] absDifference :: [Double] -> [Double] -> Double nearlyEqual :: [Double] -> [Double] -> Bool gridToList :: Grid -> IO [Double] vectorLength :: Int -> Int listToVec :: [Double] -> IO DVector zeroGrid :: Grid -> IO () swap :: Grid -> Grid -> IO () testSetBnd :: IO () testLinSolveStep :: IO () testLinSolve :: IO () testAdvect :: IO () testProject :: IO () testVelStep :: IO () main :: IO (Maybe a) tests :: IO () *MFluid> tests Loading package primitive-0.3.1 ... linking ... done. Loading package vector-0.7.1 ... linking ... done. Testing setBnd True Testing LinSolveStep True Testing LinSolve True Testing advect True Testing project True VelStep testing True *MFluid> </pre>
  • 21.

    And Jeff's other program works after a couple of tweaks and removing Criterion dependency cos I can't get it to build at the moment.

    Here are the working function types and test results for Fluid.hs

    
    *Fluid> :browse
    type DVector = Data.Vector.Unboxed.Base.Vector Double
    data Grid = Grid Int DVector
    emptyBoard :: Int -> Grid
    get :: Grid -> (Int, Int) -> Double
    ix :: Int -> (Int, Int) -> Int
    addSource :: Grid -> Grid -> Double -> Grid
    setBnd :: Int -> Grid -> Grid
    linSolve' :: Int -> Double -> Double -> Grid -> Grid -> Grid
    linSolve :: Int -> Grid -> Grid -> Double -> Double -> Grid
    diffuse :: Int -> Grid -> Grid -> Double -> Double -> Grid
    advect :: Int -> Grid -> (Grid, Grid) -> Double -> Grid
    project :: (Grid, Grid) -> ((Grid, Grid), (Grid, Grid))
    Fluid.div :: (Grid, Grid) -> Grid
    densStep ::
      Grid -> Grid -> (Grid, Grid) -> Double -> Double -> (Grid, Grid)
    velStep ::
      (Grid, Grid) -> (Grid, Grid) -> Double -> Double -> (Grid, Grid)
    main :: IO ()
    testSetBnd :: Test.HUnit.Base.Test
    testLinSolveStep :: Test.HUnit.Base.Test
    testLinSolveStep3 :: Test.HUnit.Base.Test
    testAdvect :: Test.HUnit.Base.Test
    absDifference :: DVector -> DVector -> Double
    nearlyEqual :: DVector -> DVector -> Bool
    testDensStep :: Test.HUnit.Base.Test
    testDiv :: Test.HUnit.Base.Test
    testLinSolveP :: Test.HUnit.Base.Test
    testProject :: Test.HUnit.Base.Test
    tests :: Test.HUnit.Base.Test
    *Fluid> tests
    Loading package HUnit-1.2.2.3 ... linking ... done.
    TestList [TestLabel setBnd TestCase _,TestLabel linSolveStep TestCase _,TestLabel linSolveStep3 TestCase _,TestLabel advect TestCase _,TestLabel densStep TestCase _,TestLabel project TestCase _,TestLabel LinSolveP TestCase _,TestLabel div TestCase _]
    
    Comment Source:And Jeff's other program works after a couple of tweaks and removing Criterion dependency cos I can't get it to build at the moment. Here are the working function types and test results for Fluid.hs <pre> *Fluid> :browse type DVector = Data.Vector.Unboxed.Base.Vector Double data Grid = Grid Int DVector emptyBoard :: Int -> Grid get :: Grid -> (Int, Int) -> Double ix :: Int -> (Int, Int) -> Int addSource :: Grid -> Grid -> Double -> Grid setBnd :: Int -> Grid -> Grid linSolve' :: Int -> Double -> Double -> Grid -> Grid -> Grid linSolve :: Int -> Grid -> Grid -> Double -> Double -> Grid diffuse :: Int -> Grid -> Grid -> Double -> Double -> Grid advect :: Int -> Grid -> (Grid, Grid) -> Double -> Grid project :: (Grid, Grid) -> ((Grid, Grid), (Grid, Grid)) Fluid.div :: (Grid, Grid) -> Grid densStep :: Grid -> Grid -> (Grid, Grid) -> Double -> Double -> (Grid, Grid) velStep :: (Grid, Grid) -> (Grid, Grid) -> Double -> Double -> (Grid, Grid) main :: IO () testSetBnd :: Test.HUnit.Base.Test testLinSolveStep :: Test.HUnit.Base.Test testLinSolveStep3 :: Test.HUnit.Base.Test testAdvect :: Test.HUnit.Base.Test absDifference :: DVector -> DVector -> Double nearlyEqual :: DVector -> DVector -> Bool testDensStep :: Test.HUnit.Base.Test testDiv :: Test.HUnit.Base.Test testLinSolveP :: Test.HUnit.Base.Test testProject :: Test.HUnit.Base.Test tests :: Test.HUnit.Base.Test *Fluid> tests Loading package HUnit-1.2.2.3 ... linking ... done. TestList [TestLabel setBnd TestCase _,TestLabel linSolveStep TestCase _,TestLabel linSolveStep3 TestCase _,TestLabel advect TestCase _,TestLabel densStep TestCase _,TestLabel project TestCase _,TestLabel LinSolveP TestCase _,TestLabel div TestCase _] </pre>
Sign In or Register to comment.