Skip to content

Commit ea0b9be

Browse files
committed
6_inv_free
1 parent 1790261 commit ea0b9be

4 files changed

Lines changed: 25 additions & 19 deletions

File tree

simulators/6_inv_free/src/NeoHookeanEnergy.cu

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ T NeoHookeanEnergy<T, dim>::val()
9696
NeoHookeanEnergyVal(E, Mu, Lambda,X,device_IB(i),device_vol(i));
9797
device_val(i) = E; })
9898
.wait();
99-
display_vec(device_val);
10099
return devicesum(device_val);
101100
}
102101

simulators/6_inv_free/src/NeoHookean_auto.cu

Lines changed: 16 additions & 10 deletions
Large diffs are not rendered by default.

simulators/6_inv_free/src/main.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#include "simulator.h"
2-
2+
#include "Eigen/Dense"
3+
#include <iostream>
34
int main()
45
{
5-
float nu = 0.4, E = 1e5;
6-
float Mu = E / (2 * (1 + nu)), Lam = E * nu / ((1 + nu) * (1 - 2 * nu));
7-
float rho = 1000,
8-
k = 2e4, initial_stretch = 1, n_seg = 4, h = 0.01, side_len = 1, tol = 0.01, mu = 0.11;
6+
double nu = 0.4, E = 1e5;
7+
double Mu = E / (2 * (1 + nu)), Lam = E * nu / ((1 + nu) * (1 - 2 * nu));
8+
double rho = 1000,
9+
k = 4e4, initial_stretch = 1, n_seg = 10, h = 0.01, side_len = 1, tol = 0.01, mu = 0.11;
910
// printf("Running mass-spring simulator with parameters: rho = %f, k = %f, initial_stretch = %f, n_seg = %d, h = %f, side_len = %f, tol = %f\n", rho, k, initial_stretch, n_seg, h, side_len, tol);
10-
InvFreeSimulator<float, 2> simulator(rho, side_len, initial_stretch, k, h, tol, mu, Mu, Lam, n_seg);
11+
InvFreeSimulator<double, 2> simulator(rho, side_len, initial_stretch, k, h, tol, mu, Mu, Lam, n_seg);
1112
simulator.run();
1213
}

simulators/6_inv_free/src/simulator.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ InvFreeSimulator<T, dim>::Impl::Impl(T rho, T side_len, T initial_stretch, T K,
6767
DBC_limit.push_back(0);
6868
DBC_limit.push_back(-0.6);
6969
DBC_v.push_back(0);
70-
DBC_v.push_back(-0.5);
70+
DBC_v.push_back(-0.3);
7171
DBC_stiff = 10;
7272
x.push_back(0);
7373
x.push_back(side_len * 0.6);
@@ -145,7 +145,7 @@ void InvFreeSimulator<T, dim>::Impl::step_forward()
145145
update_x_tilde(add_vector<T>(x, v, 1, h));
146146
frictionenergy.update_mu_lambda(barrierenergy.compute_mu_lambda(mu));
147147
update_DBC_target();
148-
update_DBC_stiff(10);
148+
// update_DBC_stiff(10);
149149
DeviceBuffer<T> x_n = x; // Copy current positions to x_n
150150
update_v(add_vector<T>(x, x_n, 1 / h, -1 / h));
151151
int iter = 0;

0 commit comments

Comments
 (0)