nickabattista / IB2d

An easy to use immersed boundary method in 2D, with full implementations in MATLAB and Python that contains over 75 built-in examples, including multiple options for fiber-structure models and advection-diffusion, Boussinesq approximations, and/or artificial forcing.
GNU General Public License v3.0
164 stars 90 forks source link

create geometry with two cylinders #4

Closed deleeke closed 7 years ago

deleeke commented 7 years ago

@nickabattista Nick,

Elijah here from the Math 564 class. I'm trying to figure out how to add another cylinder to this example in your code and I am running into trouble. Essentially what I did was:

1) Change all the print_Lagrangian_* functions to accept a file permission mode parameter. 2) Create a second cylinder 3) each time to write to the file with data from the first cylinder, use 'w' mode, which clears out old data 4) each time to write the file with the data from the second cylinder, use 'a' mode, which appends to the end of the file

When I run the function VIV_Cylinder2_Geometry(), I see a graph of geometry much like I would like to have with two cylinders tethered to the boundary. Also the line count of the .spring file and other related files seem to be about twice as long, so there is some more data in there.

But now when I run main2d() I get this error:

|****** Begin IMMERSED BOUNDARY SIMULATION! ******| 

Current Time(s): 0.000000
Subscript indices must either be real positive integers or logicals.

Error in please_Find_Lagrangian_Forces_On_Eulerian_grid>give_Me_Spring_Lagrangian_Force_Densities (line 251)
    dx = xLag(id_Slave) - xLag(id_Master); % x-Distance btwn slave and master node

Error in please_Find_Lagrangian_Forces_On_Eulerian_grid (line 125)
    [fx_springs, fy_springs] = give_Me_Spring_Lagrangian_Force_Densities(ds,Nb,xLag,yLag,springs);

Error in IBM_Driver (line 476)
    [Fxh, Fyh, F_Mass_Bnd, F_Lag] =    please_Find_Lagrangian_Forces_On_Eulerian_grid(dt, current_time, xLag_h,
    yLag_h, xLag_P, yLag_P, x, y, grid_Info, model_Info, springs_info, target_info, beams_info, muscles_info,
    muscles3_info, mass_info, electro_potential, d_springs_info);

Error in main2d (line 100)
[X, Y, U, V, xLags, yLags] = IBM_Driver(struct_name, mu, rho, grid_Info, dt, T_final, model_Info);

I'm not really sure what to make of that error. So, in short, am I on the correct track at all in trying to create this additional cylinder? And if so, do you have any ideas as to how I can ameliorate this error?