Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fluidparticles
MigFlow
Commits
68186aa3
Commit
68186aa3
authored
May 05, 2021
by
Jonathan Lambrechts
Browse files
init r0, r1
parent
46d080d0
Pipeline
#9336
failed with stages
in 2 minutes and 21 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
scontact/scontact.c
View file @
68186aa3
...
...
@@ -137,10 +137,6 @@ struct _PeriodicTriangle {
};
#endif
static
double
dot
(
const
double
*
x
,
const
double
*
y
)
{
#if DIMENSION == 3
return
x
[
0
]
*
y
[
0
]
+
x
[
1
]
*
y
[
1
]
+
x
[
2
]
*
y
[
2
];
...
...
@@ -337,8 +333,7 @@ static int contact_init_disk_particle(Contact *c, ParticleProblem *p, size_t dis
}
c
->
type
=
PARTICLE_DISK
;
double
basis
[
DIMENSION
][
DIMENSION
];
double
r0
[
DIMENSION
],
r1
[
DIMENSION
];
double
D
=
contact_update_disk_particle
(
c
,
p
,
x
,
basis
,
r0
,
r1
);
double
D
=
contact_update_disk_particle
(
c
,
p
,
x
,
basis
,
c
->
r0
,
c
->
r1
);
c
->
D0
=
fmin
(
D
,
0
);
return
D
<
alert
;
}
...
...
@@ -412,8 +407,7 @@ static int contact_init_segment_particle(Contact *c, ParticleProblem *p, size_t
}
c
->
type
=
PARTICLE_SEGMENT
;
double
basis
[
DIMENSION
][
DIMENSION
];
double
r0
[
DIMENSION
],
r1
[
DIMENSION
];
double
D
=
contact_update_segment_particle
(
c
,
p
,
x
,
basis
,
r0
,
r1
);
double
D
=
contact_update_segment_particle
(
c
,
p
,
x
,
basis
,
c
->
r0
,
c
->
r1
);
c
->
D0
=
fmin
(
D
,
0
);
return
D
<
alert
;
}
...
...
@@ -804,8 +798,6 @@ void contact_tree_add_particle(ContactTree *tree, int id, const Contact *old_con
if
((
cold
=
findContactSorted
(
c
,
old_contacts
,
iold
)))
{
for
(
int
d
=
0
;
d
<
DIMENSION
;
++
d
)
{
c
->
reaction
[
d
]
=
cold
->
reaction
[
d
];
c
->
r0
[
d
]
=
cold
->
r0
[
d
];
c
->
r1
[
d
]
=
cold
->
r1
[
d
];
}
}
}
...
...
@@ -855,8 +847,6 @@ static void contact_tree_gen_boundary_contact(ContactTree *tree, ContactType typ
if
((
cold
=
findContactSorted
(
c
,
old_contacts
,
iold
)))
{
for
(
int
d
=
0
;
d
<
DIMENSION
;
++
d
)
{
c
->
reaction
[
d
]
=
cold
->
reaction
[
d
];
c
->
r0
[
d
]
=
cold
->
r0
[
d
];
c
->
r1
[
d
]
=
cold
->
r1
[
d
];
}
}
}
...
...
@@ -1023,10 +1013,10 @@ static int contact_solve(ParticleProblem *p, Contact *c, double dt, double tol)
}
// allow the pre-existing (from previous time steps) interpenetrations
D
-=
c
->
D0
;
double
p
old
[
DIMENSION
]
=
{
0
};
double
r
old
[
DIMENSION
]
=
{
0
};
// un-apply the old contact
for
(
int
d
=
0
;
d
<
DIMENSION
;
++
d
)
{
p
old
[
d
]
=
c
->
reaction
[
d
]
*
dt
;
r
old
[
d
]
=
c
->
reaction
[
d
];
}
contact_apply
(
c
,
p
,
-
dt
);
for
(
int
d
=
0
;
d
<
DIMENSION
;
++
d
)
{
...
...
@@ -1044,9 +1034,9 @@ static int contact_solve(ParticleProblem *p, Contact *c, double dt, double tol)
double
wdet
=
wnn
*
wtt
-
wnt
*
wnt
;
double
v
[
DIMENSION
]
=
{
0
.};
// local free velocity in the contact basis
contact_get_local_velocity
(
c
,
p
,
v
,
basis
);
// v[0] < 0 if particles get closer
double
old
p
n
=
p
old
[
0
]
*
basis
[
0
][
0
]
+
p
old
[
1
]
*
basis
[
0
][
1
];
double
old
p
t
=
p
old
[
0
]
*
basis
[
1
][
0
]
+
p
old
[
1
]
*
basis
[
1
][
1
];
v
[
0
]
=
fmin
(
D
/
dt
-
old
p
n
*
wnn
-
old
p
t
*
wnt
,
0
.);
double
old
r
n
=
r
old
[
0
]
*
basis
[
0
][
0
]
+
r
old
[
1
]
*
basis
[
0
][
1
];
double
old
r
t
=
r
old
[
0
]
*
basis
[
1
][
0
]
+
r
old
[
1
]
*
basis
[
1
][
1
];
v
[
0
]
=
fmin
(
D
/
dt
-
dt
*
(
old
r
n
*
wnn
+
old
r
t
*
wnt
)
,
0
.);
double
pstick
[
2
]
=
{
-
(
+
wtt
*
v
[
0
]
-
wnt
*
v
[
1
])
/
wdet
,
-
(
-
wnt
*
v
[
0
]
+
wnn
*
v
[
1
])
/
wdet
...
...
@@ -1067,22 +1057,22 @@ static int contact_solve(ParticleProblem *p, Contact *c, double dt, double tol)
pt
=
pstick
[
1
];
}
}
c
->
reaction
[
0
]
=
(
pn
*
basis
[
0
][
0
]
+
pt
*
basis
[
1
][
0
])
/
dt
;
c
->
reaction
[
1
]
=
(
pn
*
basis
[
0
][
1
]
+
pt
*
basis
[
1
][
1
])
/
dt
;
c
->
reaction
[
0
]
=
(
pn
*
basis
[
0
][
0
]
+
pt
*
basis
[
1
][
0
])
/
dt
;
c
->
reaction
[
1
]
=
(
pn
*
basis
[
0
][
1
]
+
pt
*
basis
[
1
][
1
])
/
dt
;
// apply new contact and check convergence
double
d
v
max
=
0
;
double
d
r
max
=
0
;
#if DIMENSION == 2
double
d
p
[
DIMENSION
];
double
d
r
[
DIMENSION
];
for
(
int
d
=
0
;
d
<
DIMENSION
;
++
d
)
{
d
p
[
d
]
=
c
->
reaction
[
d
]
*
dt
-
p
old
[
d
];
d
r
[
d
]
=
c
->
reaction
[
d
]
-
r
old
[
d
];
}
d
v
max
=
fmax
(
fabs
(
d
p
[
0
]
*
wnn
+
d
p
[
1
]
*
wnt
),
fabs
(
d
p
[
0
]
*
wnt
+
d
p
[
1
]
*
wtt
));
d
r
max
=
fmax
(
fabs
(
d
r
[
0
]
*
wnn
+
d
r
[
1
]
*
wnt
),
fabs
(
d
r
[
0
]
*
wnt
+
d
r
[
1
]
*
wtt
));
#else
//TOD0
#endif
contact_apply
(
c
,
p
,
dt
);
return
d
v
max
<
tol
/
dt
;
return
d
r
max
*
dt
*
dt
<
tol
;
}
void
swap
(
int
*
a
,
int
*
b
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment