Skip to content

Commit 7f50fab

Browse files
committed
Set default material parameters for vbd::Data
1 parent 6c205bb commit 7f50fab

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

source/pbat/sim/vbd/Data.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "Data.h"
22

3+
#include "pbat/physics/HyperElasticity.h"
4+
35
#include <algorithm>
46
#include <exception>
57
#include <fmt/format.h>
@@ -131,13 +133,33 @@ Data& Data::Construct(bool bValidate)
131133
{
132134
// clang-format off
133135
if (xt.size() == 0)
136+
{
134137
xt = x;
138+
}
135139
if (v.size() == 0)
140+
{
136141
v.setZero(x.rows(), x.cols());
142+
}
143+
if (m.size() == 0)
144+
{
145+
m.setConstant(x.cols(), Scalar(1e3));
146+
}
147+
if (aext.size() == 0)
148+
{
149+
aext.resizeLike(x);
150+
aext.colwise() = Vector<3>{Scalar(0), Scalar(0), Scalar(-9.81)};
151+
}
137152
xtilde.resizeLike(x);
138153
xchebm2.resizeLike(x);
139154
xchebm1.resizeLike(x);
140155
vt.resizeLike(x);
156+
if (lame.size() == 0)
157+
{
158+
auto const [mu, lambda] = physics::LameCoefficients(Scalar(1e6), Scalar(0.45));
159+
lame.resize(2, T.cols());
160+
lame.row(0).setConstant(mu);
161+
lame.row(1).setConstant(lambda);
162+
}
141163
if (bValidate)
142164
{
143165
bool const bPerVertexQuantityDimensionsValid =

0 commit comments

Comments
 (0)