Coder Social home page Coder Social logo

pyrom's Introduction

pyROM - Reduced Order Modelling Framework for Python

Background

Solving a PDE numerically for mesh based/time dependent codes usually involves iterating through the whole spatial basis that represents the underlying system. Reduced Order Modelling involves scanning for dominant "modes" that contain most information of the happening sections. Quantitatively, a 10^4x10^4 matrix could be transformed in to a 100x3 matrix, evolution of which (and retransformation back to 10^4x10^4) may result in negligible error.

Algorithm

  1. Fetch stiffness matrix, snapshot matrix(evolved for Δt timesteps).
  2. Compute PCA/DMD/POD (user choice) to select the first N modes. Ex. - [Φ_n]=[Φ_1,Φ_23,Φ_10]
  3. Solve σ⍺=∂⍺/∂t*, where ⍺ is a kxk matrix(k is min. dimension of [Φ_n], the dependent variable C=[Φ_n][⍺]).
  4. Transform [Φ_n] back to C after t timesteps

*Fetch snapshots as and when needed

Example

#Import pyROM functions
from pyROM import *

#Plotting library
from bokeh.plotting import show, output_notebook


f=lambda x:np.sin(np.float(2*np.pi*x[0]))*np.sin(2*np.pi*x[1]) #perturbation
mydomain=Domain('examples/porous.mat',perturbation=f,cutoff=5,timesteps=24000) #Domain decomposition
mydomain.march() #Run simulation


#POD
mydomain.pod() #Computes POD and stores the value in mydomain.POD

#DMD 
mydomain.dmd() #does DMD and stores the values in mydomain.DMD

#Visualize POD
output_notebook()  #Opens bokeh notebook
out=mydomain.bokeh_out(mydomain,mydomain.POD,timesteps=300)
show(out)

#Visualize DMD
out=mydomain.bokeh_out(mydomain,mydomain.DMD,timesteps=300)
show(out)


#Visualize POD/DMD together
out=mydomain.bokeh_out(mydomain,mydomain.POD,mydomain.DMD,axis=0,timesteps=300)
show(out)

#Print timing
print ("Initialization: "+mydomain.wall
       +"\nPOD: "+mydomain.POD.wall
       +"\nDMD: "+mydomain.DMD.wall)

pyrom's People

Contributors

vpuzyrev avatar shivakarsh avatar ldxu93 avatar mghommem avatar

Watchers

James Cloos avatar

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.