-
Notifications
You must be signed in to change notification settings - Fork 9
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
Multi material support #173
base: main
Are you sure you want to change the base?
Conversation
@kinanbezem7 feel free to try this out or ask about the user interface here |
I tried using for the multi_material, inputs such as: "density" : {"value": [8000, 4000], "unit": "kg/m^3"}, and then defining the matrix and fiber densities ass: However, we use: double rho = inputs["density"]["value"]; in CabanaPD_Input.pp. Similarly, with elastic_modulus, etc. So, this needs to be generalized to work with multi-material systems. In addition, for multi-material systems, the critical time step should be the minimum of the critical time steps of any of the materials. |
src/CabanaPD_ForceModels.hpp
Outdated
// No-op for temperature. | ||
KOKKOS_INLINE_FUNCTION | ||
void thermalStretch( double&, const int, const int ) const {} | ||
void thermalStretch( const int, const int, double& ) const {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the change "const int, const int" to enable two particle indices, instead of one, for multi_material?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's particle ids
@@ -36,38 +38,72 @@ struct ForceModel<LPS, Elastic, NoFracture> : public BaseForceModel | |||
double theta_coeff; | |||
double s_coeff; | |||
|
|||
double c; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have "c" in the LPS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "duplicate" mean. Just a copy/paste mistake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just that I don't want to discuss the same thing in multiple comments
theta_coeff = 3.0 * K - 5.0 * G; | ||
s_coeff = 15.0 * G; | ||
|
||
// Equivalent PMB inputs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have "c" in the LPS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly what the comment "equivalent PMB inputs" intends - if you want to mix model types you need some kind of interoperability
ForceModel( const double _delta, const double _K, const double _G, | ||
const double _G0, const int _influence = 0 ) | ||
: base_type( _delta, _K, _G, _influence ) | ||
, G0( _G0 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change for multi_material?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a side effect of the changes
{ | ||
set_param( delta, K ); | ||
c = 18.0 * K / ( pi * delta * delta * delta * delta ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why using "pi" is OK? Shouldn't we use CabanaPD::pi?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in the CabanaPD namespace already
{ | ||
c = model.c; | ||
K = model.K; | ||
K = ( model1.K + model2.K ) / 2.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this line? We only need the average of "c"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not leave values unset. If we do what you suggest we should not keep K
at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, in the "fiber_reinforced_composite.cpp" example, we have:
double theta = stacking_sequence( nply ) * CabanaPD::pi / 180;
We also have: #include <CabanaPD_Constants.hpp>.
So, could we simply use the following?
double theta = stacking_sequence( nply ) * pi / 180;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not in the CabanaPD namespace
G0 = model.G0; | ||
s0 = model.s0; | ||
bond_break_coeff = model.bond_break_coeff; | ||
s0 = Kokkos::sqrt( 5.0 * G0 / 9.0 / K / delta ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make sure K here is not the average K.
base_type::set_param( _delta, _K ); | ||
G0 = _G0; | ||
s0 = Kokkos::sqrt( 5.0 * G0 / 9.0 / K / delta ); | ||
G0 = ( model1.G0 + model2.G0 ) / 2.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this line for?
src/force/CabanaPD_Force_LPS.hpp
Outdated
double m_j = mu( i, n ) * model.influence_function( xi ) * xi * | ||
xi * vol( j ); | ||
m( i ) += m_j; | ||
m( i ) += mu( i, n ) * model.weightedVolume( xi, vol( j ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using "model.weightedVolume" here is confusing because "m" is the weighted volume.
src/force/CabanaPD_Force_LPS.hpp
Outdated
if ( m( i ) > 0 ) | ||
theta( i ) += 3.0 * theta_i / m( i ); | ||
theta( i ) += mu( i, n ) * | ||
model.dilatation( s, xi, vol( j ), m( i ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, here theta is the "dilatation", so "model.dilatation" could be confusing.
src/force/CabanaPD_Force_LPS.hpp
Outdated
const auto vol = particles.sliceVolume(); | ||
auto linear_theta = particles.sliceDilatation(); | ||
auto theta = particles.sliceDilatation(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we change "linear_theta" to "theta"? We still use "linear_s" below.
src/force/CabanaPD_Force_LPS.hpp
Outdated
auto model = _model; | ||
auto neigh_list = _neigh_list; | ||
|
||
const auto vol = particles.sliceVolume(); | ||
const auto linear_theta = particles.sliceDilatation(); | ||
const auto theta = particles.sliceDilatation(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
Variadic models, only support binary currently
Redefine model inheritance to avoid diamonds
9d7db05
to
66e534d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still a lot of changes to be made here. I appreciate a detailed review, but I'm afraid you'll spend more time than necessary before this is finished
{ | ||
set_param( delta, K ); | ||
c = 18.0 * K / ( pi * delta * delta * delta * delta ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in the CabanaPD namespace already
{ | ||
c = model.c; | ||
K = model.K; | ||
K = ( model1.K + model2.K ) / 2.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not leave values unset. If we do what you suggest we should not keep K
at all
02bf7fb
to
f0d3789
Compare
Currently binary only (written to be easy to expand however)
ForceModels
accepts a variadic list or tuple of models and calls each model peri,j
pair as needed in the force loopTemporary changes to KW to test the capability - missing new bimaterial example
Built off of #172 for better composability
Replaces #119
Closes #109