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

Rename model tags #163

Merged
merged 4 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion examples/mechanics/crack_branching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void crackBranchingExample( const std::string filename )
// ====================================================
// Force model
// ====================================================
using model_type = CabanaPD::ForceModel<CabanaPD::PMB, CabanaPD::Fracture>;
using model_type = CabanaPD::ForceModel<CabanaPD::PMB>;
model_type force_model( delta, K, G0 );

// ====================================================
Expand Down
5 changes: 3 additions & 2 deletions examples/mechanics/elastic_wave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ void elasticWaveExample( const std::string filename )
// Force model
// ====================================================
using model_type =
CabanaPD::ForceModel<CabanaPD::LinearLPS, CabanaPD::Elastic>;
CabanaPD::ForceModel<CabanaPD::LinearLPS, CabanaPD::Elastic,
CabanaPD::NoFracture>;
model_type force_model( delta, K, G );

// ====================================================
Expand Down Expand Up @@ -100,7 +101,7 @@ void elasticWaveExample( const std::string filename )
// ====================================================
// Create solver
// ====================================================
auto cabana_pd = CabanaPD::createSolverElastic<memory_space>(
auto cabana_pd = CabanaPD::createSolverNoFracture<memory_space>(
inputs, particles, force_model );

// ====================================================
Expand Down
2 changes: 1 addition & 1 deletion examples/mechanics/fragmenting_cylinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void fragmentingCylinderExample( const std::string filename )
// ====================================================
// Force model
// ====================================================
using model_type = CabanaPD::ForceModel<CabanaPD::PMB, CabanaPD::Fracture>;
using model_type = CabanaPD::ForceModel<CabanaPD::PMB>;
model_type force_model( delta, K, G0 );
// using model_type =
// CabanaPD::ForceModel<CabanaPD::LPS, CabanaPD::Fracture>;
Expand Down
4 changes: 2 additions & 2 deletions examples/mechanics/kalthoff_winkler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ void kalthoffWinklerExample( const std::string filename )
// ====================================================
// Force model
// ====================================================
using model_type = CabanaPD::ForceModel<CabanaPD::PMB, CabanaPD::Fracture>;
using model_type = CabanaPD::ForceModel<CabanaPD::PMB>;
model_type force_model( delta, K, G0 );
// using model_type =
// CabanaPD::ForceModel<CabanaPD::LPS, CabanaPD::Fracture>;
// CabanaPD::ForceModel<CabanaPD::LPS>;
// model_type force_model( delta, K, G, G0 );

// ====================================================
Expand Down
7 changes: 4 additions & 3 deletions examples/thermomechanics/thermal_deformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,14 @@ void thermalDeformationExample( const std::string filename )
// ====================================================
// Force model
// ====================================================
auto force_model = CabanaPD::createForceModel(
model_type{}, CabanaPD::Elastic{}, *particles, delta, K, alpha, temp0 );
auto force_model =
pabloseleson marked this conversation as resolved.
Show resolved Hide resolved
CabanaPD::createForceModel( model_type{}, CabanaPD::NoFracture{},
*particles, delta, K, alpha, temp0 );

// ====================================================
// Create solver
// ====================================================
auto cabana_pd = CabanaPD::createSolverElastic<memory_space>(
auto cabana_pd = CabanaPD::createSolverNoFracture<memory_space>(
inputs, particles, force_model );

// ====================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ void thermalDeformationHeatTransferExample( const std::string filename )
// Force model
// ====================================================
auto force_model = CabanaPD::createForceModel(
model_type{}, CabanaPD::Elastic{}, *particles, delta, K, kappa, cp,
model_type{}, CabanaPD::NoFracture{}, *particles, delta, K, kappa, cp,
streeve marked this conversation as resolved.
Show resolved Hide resolved
alpha, temp0 );

// ====================================================
// Create solver
// ====================================================
auto cabana_pd = CabanaPD::createSolverElastic<memory_space>(
auto cabana_pd = CabanaPD::createSolverNoFracture<memory_space>(
inputs, particles, force_model );

// ====================================================
Expand Down
3 changes: 2 additions & 1 deletion src/CabanaPD_ForceModels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ struct BaseDynamicTemperatureModel
}
};

template <typename ModelType, typename DamageType,
template <typename PeridynamicsModelType, typename MechanicsModelType = Elastic,
typename DamageType = Fracture,
typename ThermalType = TemperatureIndependent, typename... DataTypes>
struct ForceModel;

Expand Down
2 changes: 1 addition & 1 deletion src/CabanaPD_HeatTransfer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class HeatTransfer : public Force<MemorySpace, BaseForceModel>
using base_type::_neigh_list;
using model_type = ModelType;
static_assert(
std::is_same_v<typename model_type::fracture_type, Elastic> );
std::is_same_v<typename model_type::fracture_type, NoFracture> );

// Running with mechanics as well; no reason to rebuild neighbors.
template <class NeighborType>
Expand Down
48 changes: 25 additions & 23 deletions src/CabanaPD_Solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class SolverBase

template <class MemorySpace, class InputType, class ParticleType,
class ForceModelType, class ContactModelType = NoContact>
class SolverElastic
class SolverNoFracture
{
public:
using memory_space = MemorySpace;
Expand All @@ -114,20 +114,20 @@ class SolverElastic
using contact_type = Force<memory_space, ContactModelType>;
using contact_model_type = ContactModelType;

SolverElastic( input_type _inputs,
std::shared_ptr<particle_type> _particles,
force_model_type force_model )
SolverNoFracture( input_type _inputs,
std::shared_ptr<particle_type> _particles,
force_model_type force_model )
: inputs( _inputs )
, particles( _particles )
, _init_time( 0.0 )
{
setup( force_model );
}

SolverElastic( input_type _inputs,
std::shared_ptr<particle_type> _particles,
force_model_type force_model,
contact_model_type contact_model )
SolverNoFracture( input_type _inputs,
std::shared_ptr<particle_type> _particles,
force_model_type force_model,
contact_model_type contact_model )
: inputs( _inputs )
, particles( _particles )
, _init_time( 0.0 )
Expand Down Expand Up @@ -488,12 +488,12 @@ class SolverElastic
template <class MemorySpace, class InputType, class ParticleType,
class ForceModelType, class ContactModelType = NoContact>
class SolverFracture
: public SolverElastic<MemorySpace, InputType, ParticleType, ForceModelType,
ContactModelType>
: public SolverNoFracture<MemorySpace, InputType, ParticleType,
ForceModelType, ContactModelType>
{
public:
using base_type = SolverElastic<MemorySpace, InputType, ParticleType,
ForceModelType, ContactModelType>;
using base_type = SolverNoFracture<MemorySpace, InputType, ParticleType,
ForceModelType, ContactModelType>;
using exec_space = typename base_type::exec_space;
using memory_space = typename base_type::memory_space;

Expand Down Expand Up @@ -735,24 +735,26 @@ class SolverFracture

template <class MemorySpace, class InputsType, class ParticleType,
class ForceModelType>
auto createSolverElastic( InputsType inputs,
std::shared_ptr<ParticleType> particles,
ForceModelType model )
auto createSolverNoFracture( InputsType inputs,
std::shared_ptr<ParticleType> particles,
ForceModelType model )
{
return std::make_shared<
SolverElastic<MemorySpace, InputsType, ParticleType, ForceModelType>>(
return std::make_shared<SolverNoFracture<MemorySpace, InputsType,
ParticleType, ForceModelType>>(
inputs, particles, model );
}

template <class MemorySpace, class InputsType, class ParticleType,
class ForceModelType, class ContactModelType>
auto createSolverElastic( InputsType inputs,
std::shared_ptr<ParticleType> particles,
ForceModelType model, ContactModelType contact_model )
auto createSolverNoFracture( InputsType inputs,
std::shared_ptr<ParticleType> particles,
ForceModelType model,
ContactModelType contact_model )
{
return std::make_shared<SolverElastic<MemorySpace, InputsType, ParticleType,
ForceModelType, ContactModelType>>(
inputs, particles, model, contact_model );
return std::make_shared<
SolverNoFracture<MemorySpace, InputsType, ParticleType, ForceModelType,
ContactModelType>>( inputs, particles, model,
contact_model );
}

template <class MemorySpace, class InputsType, class ParticleType,
Expand Down
9 changes: 7 additions & 2 deletions src/CabanaPD_Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@
namespace CabanaPD
{
// Fracture tags.
struct Elastic
struct NoFracture
{
};
struct Fracture
{
};

// Contact and DEM (contact without PD) tags.
// Mechanics tags.
struct Elastic
{
};

// Contact and DEM (contact without PD) tags.
struct NoContact
{
};
Expand All @@ -37,6 +41,7 @@ struct TemperatureIndependent
{
using base_type = TemperatureIndependent;
};

struct TemperatureDependent
{
using base_type = TemperatureDependent;
Expand Down
2 changes: 1 addition & 1 deletion src/force/CabanaPD_ContactModels.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct NormalRepulsionModel : public ContactModel
{
// FIXME: This is for use as the primary force model.
using base_model = PMB;
using fracture_type = Elastic;
using fracture_type = NoFracture;
pabloseleson marked this conversation as resolved.
Show resolved Hide resolved
using thermal_type = TemperatureIndependent;

using ContactModel::delta;
Expand Down
21 changes: 11 additions & 10 deletions src/force/CabanaPD_ForceModels_LPS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
namespace CabanaPD
{
template <>
struct ForceModel<LPS, Elastic> : public BaseForceModel
struct ForceModel<LPS, Elastic, NoFracture> : public BaseForceModel
{
using base_type = BaseForceModel;
using base_model = LPS;
using fracture_type = Elastic;
using fracture_type = NoFracture;
using thermal_type = TemperatureIndependent;

using base_type::delta;
Expand All @@ -34,7 +34,6 @@ struct ForceModel<LPS, Elastic> : public BaseForceModel
double theta_coeff;
double s_coeff;

ForceModel(){};
ForceModel( const double _delta, const double _K, const double _G,
const int _influence = 0 )
: base_type( _delta )
Expand Down Expand Up @@ -63,9 +62,10 @@ struct ForceModel<LPS, Elastic> : public BaseForceModel
};

template <>
struct ForceModel<LPS, Fracture> : public ForceModel<LPS, Elastic>
struct ForceModel<LPS, Elastic, Fracture>
: public ForceModel<LPS, Elastic, NoFracture>
{
using base_type = ForceModel<LPS, Elastic>;
using base_type = ForceModel<LPS, Elastic, NoFracture>;
using base_model = typename base_type::base_model;
using fracture_type = Fracture;
using thermal_type = base_type::thermal_type;
Expand All @@ -80,7 +80,6 @@ struct ForceModel<LPS, Fracture> : public ForceModel<LPS, Elastic>
double s0;
double bond_break_coeff;

ForceModel() {}
ForceModel( const double _delta, const double _K, const double _G,
const double _G0, const int _influence = 0 )
: base_type( _delta, _K, _G, _influence )
Expand All @@ -106,9 +105,10 @@ struct ForceModel<LPS, Fracture> : public ForceModel<LPS, Elastic>
};

template <>
struct ForceModel<LinearLPS, Elastic> : public ForceModel<LPS, Elastic>
struct ForceModel<LinearLPS, Elastic, NoFracture>
: public ForceModel<LPS, Elastic, NoFracture>
{
using base_type = ForceModel<LPS, Elastic>;
using base_type = ForceModel<LPS, Elastic, NoFracture>;
using base_model = typename base_type::base_model;
using fracture_type = typename base_type::fracture_type;
using thermal_type = base_type::thermal_type;
Expand All @@ -124,9 +124,10 @@ struct ForceModel<LinearLPS, Elastic> : public ForceModel<LPS, Elastic>
};

template <>
struct ForceModel<LinearLPS, Fracture> : public ForceModel<LPS, Fracture>
struct ForceModel<LinearLPS, Elastic, Fracture>
: public ForceModel<LPS, Elastic, Fracture>
{
using base_type = ForceModel<LPS, Fracture>;
using base_type = ForceModel<LPS, Elastic, Fracture>;
using base_model = typename base_type::base_model;
using fracture_type = typename base_type::fracture_type;
using thermal_type = base_type::thermal_type;
Expand Down
Loading
Loading