Skip to content

[WIP] GPU MPM and rigid body strong coupling using Jacobi solver #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 31 commits into
base: cuda-mpm-vbd
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0dc0d1d
[add, wip] coupling wip
g1n0st Dec 29, 2024
e853809
[fix] fix a bug in dt
g1n0st Jan 7, 2025
6f1ec69
[fix] fix integrating free-motion dynamic twice
g1n0st Jan 8, 2025
c3fc3b0
[rebase] rebase cuda-mpm-vbd
g1n0st Jan 19, 2025
2e43388
[update, add] implement margin for mpm and rigid
g1n0st Jan 27, 2025
65bd891
[fix, wip] fix penetration distance estimation and affine integration
g1n0st Jan 28, 2025
90848ac
[fix] fix margin in distance query
g1n0st Jan 29, 2025
08d9eac
[add] add maximum line search iterations
g1n0st Jan 29, 2025
08c5f50
[fix] implement F_p^{n+1} = Z((I + dt (C_p^{n+1} - C_p^{*})) F_p^*)
g1n0st Jan 30, 2025
1a464b1
[update] make d2lndvn2 definition consistent
g1n0st Feb 1, 2025
1e2d33a
[update] rename as affine_matrices_star for consistency
g1n0st Feb 1, 2025
8cee8b6
[update] make yn definition consistent
g1n0st Feb 1, 2025
c0f6f5f
[fix] fix comment
g1n0st Feb 1, 2025
6598906
[add] add CFL condition check
g1n0st Feb 2, 2025
d588777
[update] only enable CFL check in debug mode
g1n0st Feb 2, 2025
a76ed9d
[add] add testcases that cloth falling on flat ground with initial ro…
g1n0st Feb 2, 2025
313d8c6
[fix, update] fix notations and yn/d2lndvn2 for strong coupling
g1n0st Feb 3, 2025
22ca65c
[remove] remove stale todo
g1n0st Feb 3, 2025
a55cfbb
[fix] fix computing v_hat
g1n0st Feb 3, 2025
8af7e91
[fix, update] fix the anti-derivative of yn, N+(vn; ϕ*)
g1n0st Feb 3, 2025
ea9b359
[add] add dP(dF) operator
g1n0st Feb 4, 2025
1459591
[fix] A(1, 2) = gp * s.R(2, 2) * s.R(1, 2)
g1n0st Feb 5, 2025
9530b8b
[fix, update] remove fixed corotated PK1 derivative and document inpu…
g1n0st Feb 5, 2025
183e831
[fix] g_v_star should be accessed with a global address index
g1n0st Feb 6, 2025
b5bed4c
[add, wip] implement elasticity energy for backtracking line search u…
g1n0st Feb 6, 2025
9bd3cdd
[add, update] support elasticity energy grad/hess for exact line search
g1n0st Feb 6, 2025
507f260
[fix] fix coeff before dE and d2E of elasticity energy
g1n0st Feb 8, 2025
34a045e
[fix, update] remove unnecessary update_Kdv call
g1n0st Feb 8, 2025
899bd7e
[add] add comment
g1n0st Feb 8, 2025
1751caf
[add] add comment and note for apply_dir flag
g1n0st Feb 8, 2025
23f8647
Merge pull request #10 from g1n0st/cuda-mpm-jacobi-with-A-line-search
g1n0st Feb 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions examples/multibody/deformable/mpm_cloth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ DEFINE_string(contact_approximation, "sap",
// NOTE (changyu): here we choose k=100 for smaller amount of penetration (0.01mm or 1e-5m).
DEFINE_double(stiffness, 10.0, "Contact Stiffness.");
DEFINE_double(friction, 0.0, "Contact Friction.");
DEFINE_double(damping, 1e-5,
DEFINE_double(margin, 1.0, "MPM-Rigid Margin.");
DEFINE_double(damping, 1e-2,
"Hunt and Crossley damping for the deformable body, only used when "
"'contact_approximation' is set to 'lagged' or 'similar' [s/m].");
DEFINE_bool(exact_line_search, false, "Enable exact_line_search for contact solving.");
Expand Down Expand Up @@ -207,11 +208,23 @@ int do_main() {
std::vector<int> indices;
for (int i = 0; i < length; ++i) {
for (int j = 0; j < width; ++j) {
double z = FLAGS_testcase == 100 ? 0.051 : (FLAGS_testcase == 3? 0.26 : 0.3 + k * 0.1);
double z = (FLAGS_testcase == 100 || FLAGS_testcase == 111) ? 0.051 : (FLAGS_testcase == 3? 0.26 : 0.3 + k * 0.1);
if (FLAGS_testcase == 2) z = 0.27;
if (FLAGS_testcase == 5) z = 0.18;
inital_pos.emplace_back((0.5 - 0.5 * l) + i * dx + k * 0.01, (0.5 - 0.5 * l) + j * dx + k * 0.01, z);
inital_vel.emplace_back(0., 0., 0.);
double x = (0.5 - 0.5 * l) + i * dx + k * 0.01;
double y = (0.5 - 0.5 * l) + j * dx + k * 0.01;
inital_pos.emplace_back(x, y, z);

if (FLAGS_testcase == 111 || FLAGS_testcase == 222) {
double omega = 50.0;
double vx = -omega * (y - 0.5);
double vy = omega * (x - 0.5);
double vz = 0.0;

inital_vel.emplace_back(vx, vy, vz);
} else {
inital_vel.emplace_back(0., 0., 0.);
}
}
}

Expand Down Expand Up @@ -239,6 +252,7 @@ int do_main() {
mpm_config.contact_damping = FLAGS_damping;
mpm_config.contact_friction_mu = FLAGS_friction;
mpm_config.exact_line_search = FLAGS_exact_line_search;
mpm_config.margin = FLAGS_margin;
deformable_model.SetMpmConfig(std::move(mpm_config));

/* All rigid and deformable models have been added. Finalize the plant. */
Expand Down Expand Up @@ -301,7 +315,7 @@ int do_main() {
meshcat->StopRecording();
meshcat->PublishRecording();

std::ofstream htmlFile("/home/changyu/Desktop/cloth.html");
std::ofstream htmlFile("/home/changyu/drake/cloth.html");
htmlFile << meshcat->StaticHtml();
htmlFile.close();
}
Expand Down
1 change: 1 addition & 0 deletions multibody/gpu_mpm/cpu_mpm_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct MpmConfigParams {
int contact_query_frequency{1};
int mpm_bc{-1};
bool exact_line_search {false};
T margin{static_cast<T>(1.0)};
};

// NOTE(changyu): `CpuMpmModel` is responsive to store the initial config in `DeformableModel`,
Expand Down
Loading