Skip to content

Commit

Permalink
adding README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
filippocasari committed Jun 21, 2023
1 parent 3ed66bd commit d501bac
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Dissipative Particle Dynamics
### Assignment 4 Particles Method
To run the experiments, use Cmake. Some instructions within CmakeLists.txt are platform-dependent. So, ensure you have changed hard-coded linking.\\
Thank to [matplolibcpp](https://github.com/lava/matplotlib-cpp) for the plotting library in cpp.

### Ex a)

![alt text](images/ex_a.png "test A")

### Ex b)

![alt text](images/ex_b.png "test B")

### Ex c)
![alt text](images/ex_c.png "test C")
Binary file added images/ex_a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ex_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ex_c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ struct PairHash {

int main(int argc, char *argv[]) {
//plt::detail::_interpreter::kill();
int test =0;
int test =1; // 0 = no walls, just fluid, 1 = walls & chain molecules, 2 = fixed walls & ring molecules
assert(test<3 && test>=0);
double body_force =0.3;
double L = 15;
double rc = 1.0;
Expand Down Expand Up @@ -117,7 +118,7 @@ int main(int argc, char *argv[]) {
for(int a=0; a<2;a++){
int xcell = static_cast<int>( center_x+double(a)*1/ro / rc);
int ycell = static_cast<int>( center_y / rc);
cout<<"chain "<<i<<" particle type= "<<"A, "<<xcell<<" "<<ycell<<endl;
//cout<<"chain "<<i<<" particle type= "<<"A, "<<xcell<<" "<<ycell<<endl;
Particle p;
if(a==0){
p= Particle(center_x+double(a)*1.0/ro,center_y,0,0,1,L,xcell,ycell,num_particles_in_molecules+a,"A", test, -1, num_particles_in_molecules+a+1, i);
Expand All @@ -132,7 +133,7 @@ int main(int argc, char *argv[]) {
for(int b =2; b<7;b++){
int xcell = static_cast<int>(center_x+double(b)*1/ro / rc);
int ycell = static_cast<int>(center_y / rc);
cout<<"chain "<<i<<" particle type= "<<"B, "<<xcell<<" "<<ycell<<endl;
//cout<<"chain "<<i<<" particle type= "<<"B, "<<xcell<<" "<<ycell<<endl;
Particle p;
if(b ==6){
p = Particle(center_x+double(b)*1.0/ro,center_y,0,0,1,L,xcell,ycell,num_particles_in_molecules+b,"B", test, num_particles_in_molecules+b-1,-1,i);
Expand Down Expand Up @@ -254,7 +255,7 @@ int main(int argc, char *argv[]) {
cout<<"size of cell list: "<<cell_list.size()<<endl;
cout<<"size particle list "<<particle_list.size()<<endl;
for (auto &i: particle_list) {
cout<<"particle "<<i.id<<" in cell "<<i.i<<", "<<i.j<<endl;
//cout<<"particle "<<i.id<<" in cell "<<i.i<<", "<<i.j<<endl;
cell_list[i.i][i.j].push_back(i);

}
Expand Down

0 comments on commit d501bac

Please sign in to comment.