Giter Site home page Giter Site logo

emapco / ca-project Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 463 KB

CHEM274B Group Project: Chongye Feng, Emmanuel Cortes, Trevor Oldham

Home Page: https://emapco.github.io/CA-project/html/index.html

C++ 92.24% Makefile 5.08% Python 2.68%
cellular-automata cpp doxygen group-project

ca-project's People

Contributors

emapco avatar trevoroldham avatar tsukitiger avatar

Stargazers

 avatar

Watchers

 avatar  avatar

ca-project's Issues

Galaxy model user iterface

We need main function logic (maybe create a function that passes variables by reference so that they can be changed) to allow user III to set the experiment conditions either similar to argparse or use cout to prompt the user for input and cin to get input. The latter is probably the simplest and allows us to handle invalid inputs.

  • dimensions (x, y, z)
    • x | y | z > 2
  • boundary_radius
    • error check that radius is 0 < r < x | y | z
  • min_mass
    • cell initial smallest possible mass
  • max_mass
    • cell initial max possible mass
  • density (probability)
    • 0.0 < pr < 1.0
  • time_step
    • t > 0

Output data structure

We need to be able to output Tensors of rank 1, 2 and 3 to a data file for data analysis and visualization.

Galaxy model physics-related functions

Define these functions in Include/galaxyutils.h and implement in Utils/galaxyutils.cpp.

std::vector<double> compute_gravitational_force(const GalaxyCell &cell_of_interest, const GalaxyCell &neighbor_cell, const std::vector<int> &neighbor_index);

std::vector<double> compute_accel(const std::vector<double> &total_force, double mass);

std::vector<double> compute_velocity(const std::vector<double> &accel, double time_step);

std::vector<double> compute_displacement(const std::vector<double> &velocity, const GalaxyCell &cell_of_interest, double time_step);

double compute_vector_norm(const std::vector<double> &vector);

std::vector<double> compute_vector_distance(const std::vector<double> &vec1, const std::vector<double> &vec2);

CA class design

Trevor: Writing the CA class structure and basic test of functionality. In Progress

Transition function

The transition function is required to incorporate the chosen rule_type, boundary_type, and neighbor_type in order to update the cellular automata cells' state.

Gravitational Rule for CA application

Data the function will need: 

  • the neighboring cell states as well as our cell of interest state:
    • we might need to template our cell states to be structs that can contain a state property (for compatibility with general library) plus other properties
    • we'll need to store weight (maybe stored as state), current acceleration, current velocity. Position can be stored as the cell's index (cells will need to move)
    • index for each neighboring cell (to compute distances)

Equations will need

  • $\vec{F}= M\vec{A}$
  • $\vec{F}= \vec{F_1} + \vec{F_2} + \vec{F_3} + \dots$ where each $\vec{F_i}$ is a force vector between our cell of interest and one of it's neighbors. (superposition principle)
  • Newton's Gravitational force: $\vec{F} = G\frac{m_1*m_2}{|r|^2} * \hat{r}$ where $r$ is the radial distance and $\hat{r} = \frac{\vec{r}}{|r|}$
    • maybe we can set G to 1 to simplify the model 
  • kinematic equations:

Some ideas/concerns:

  • We can use the above equations to update cell positions
    • We need some kind of tie-breaker or special handling when two cells move to the same cell in the same step
  • I'll look into generating a neighbors vector/matrix/tensor so that we can pass it to the custom rule function.
    • This will improve some of the step function logic I have written. Currently the code calculates both the sum of cell states and votes even though only one or neither is needed.
    • I might "flatten" the neighbors and additionally store their original indices (might not be needed; might be able to reverse the logic to decipher their original indices based on their flatten array position and tensor dimensions.

I'm probably missing some things so please provide input.

Bug/Failure state: boundary_radius > axisX_dim

If boundary_radius is greater than axisX_dim than valgrind reports memory access errors.

boundary_radius should be axisX_dim/2 to avoid double counting of neighbors.

Possible solution:

  • add error check in setup_dimension_Xd to prevent setting dimensions less than boundary_radius.

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.