Skip to content
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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Multi material support #173

wants to merge 10 commits into from

Conversation

streeve
Copy link
Collaborator

@streeve streeve commented Jan 13, 2025

Currently binary only (written to be easy to expand however)
ForceModels accepts a variadic list or tuple of models and calls each model per i,j pair as needed in the force loop

Temporary changes to KW to test the capability - missing new bimaterial example
Built off of #172 for better composability

Replaces #119
Closes #109

@streeve streeve added the enhancement New feature or request label Jan 13, 2025
@streeve streeve self-assigned this Jan 13, 2025
@streeve
Copy link
Collaborator Author

streeve commented Jan 13, 2025

@kinanbezem7 feel free to try this out or ask about the user interface here

@pabloseleson
Copy link
Collaborator

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:
double rho0_m = inputs["density"][0];
double rho0_f = inputs["density"][1];

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.

// No-op for temperature.
KOKKOS_INLINE_FUNCTION
void thermalStretch( double&, const int, const int ) const {}
void thermalStretch( const int, const int, double& ) const {}
Copy link
Collaborator

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?

Copy link
Collaborator Author

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;
Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate

Copy link
Collaborator

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?

Copy link
Collaborator Author

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.
Copy link
Collaborator

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?

Copy link
Collaborator Author

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 )
Copy link
Collaborator

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?

Copy link
Collaborator Author

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 );
Copy link
Collaborator

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?

Copy link
Collaborator Author

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;
Copy link
Collaborator

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"

Copy link
Collaborator Author

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

Copy link
Collaborator

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;

Copy link
Collaborator Author

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 );
Copy link
Collaborator

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;
Copy link
Collaborator

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?

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 ) );
Copy link
Collaborator

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.

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 ) );
Copy link
Collaborator

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.

const auto vol = particles.sliceVolume();
auto linear_theta = particles.sliceDilatation();
auto theta = particles.sliceDilatation();
Copy link
Collaborator

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.

auto model = _model;
auto neigh_list = _neigh_list;

const auto vol = particles.sliceVolume();
const auto linear_theta = particles.sliceDilatation();
const auto theta = particles.sliceDilatation();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Collaborator Author

@streeve streeve left a 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 );
Copy link
Collaborator Author

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;
Copy link
Collaborator Author

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

@streeve streeve added the example New example problem label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request example New example problem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple Materials
2 participants