Skip to content

Commit

Permalink
Merge pull request #225 from lanl/RZsolver
Browse files Browse the repository at this point in the history
RZ solver and user material model updates
  • Loading branch information
nathanielmorgan authored Sep 6, 2024
2 parents 104eb2e + c10b4b1 commit 92ade59
Show file tree
Hide file tree
Showing 12 changed files with 148 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ void SGH3D::get_force(const Material_t& Materials,
node_vel,
GaussPoints_vol(elem_gid),
dt,
rk_alpha);
rk_alpha,
Materials.strength_global_vars);
} // end logical on increment_based strength model
}); // end parallel for loop over elements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ void SGH3D::update_state(
node_vel,
GaussPoints_vol(gauss_gid),
dt,
rk_alpha);
rk_alpha,
Materials.strength_global_vars);
}); // end parallel for over mat elem lid
} // end if state_based strength model

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,21 @@ void SGHRZ::get_force_rz(const Material_t& Materials,
// Wilkins used elem_area*0.25 for the corner area, we will use the corner
// areas calculated using Barlow's symmetry and energy preserving area partitioning
if (node_radius > tiny) {

// sigma_RZ / R_p
corner_force(corner_gid, 0) += tau(1, 0) * corner_areas(corner_lid) / node_radius;
double force_term_1 = tau(1, 0) * corner_areas(corner_lid) / node_radius;
//force_term_1 = tau(1, 0) * 0.25*elem_area / node_radius; // Wilkins

corner_force(corner_gid, 0) += force_term_1;
MaterialCorners_force(mat_corner_lid, 0) += force_term_1;

// (sigma_RR - sigma_theta) / R_p
corner_force(corner_gid, 1) += (tau(1, 1) - tau(2, 2)) * corner_areas(corner_lid) / node_radius;
double force_term_2 = (tau(1, 1) - tau(2, 2)) * corner_areas(corner_lid) / node_radius;
//force_term_2 = (tau(1, 1) - tau(2, 2)) * 0.25*elem_area / node_radius; // Wilkins

corner_force(corner_gid, 1) += force_term_2;
MaterialCorners_force(mat_corner_lid, 1) += force_term_2;

} // end if radius >0

} // end if eroded
Expand Down Expand Up @@ -449,7 +459,8 @@ void SGHRZ::get_force_rz(const Material_t& Materials,
node_vel,
GaussPoints_vol(elem_gid),
dt,
rk_alpha);
rk_alpha,
Materials.strength_global_vars);
} // end logical on increment_based strength model
}); // end parallel for loop over elements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ void SGHRZ::update_state_rz(
node_vel,
GaussPoints_vol(gauss_gid),
dt,
rk_alpha);
rk_alpha,
Materials.strength_global_vars);


}); // end parallel for over mat elem lid
Expand Down
11 changes: 6 additions & 5 deletions single-node-refactor/src/common/include/material.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static std::map<std::string, model::EOSModels> eos_models_map
{ "no_eos", model::noEOS },
{ "gamma_law_gas", model::gammaLawGasEOS },
{ "void", model::voidEOS },
{ "user_defined", model::userDefinedEOS },
{ "user_defined_eos", model::userDefinedEOS },
};

static std::map<std::string, model::ErosionModels> erosion_model_map
Expand Down Expand Up @@ -184,7 +184,7 @@ struct MaterialFunctions_t
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t MaterialPoints_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_state_vars,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand All @@ -194,7 +194,7 @@ struct MaterialFunctions_t
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t MaterialPoints_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_state_vars,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand All @@ -207,7 +207,7 @@ struct MaterialFunctions_t
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t MaterialPoints_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_state_vars,
const DCArrayKokkos<double>& MaterialPoints_strength_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand All @@ -217,7 +217,8 @@ struct MaterialFunctions_t
const DCArrayKokkos<double>& node_vel,
const double vol,
const double dt,
const double rk_alpha) = NULL;
const double rk_alpha,
const RaggedRightArrayKokkos<double> &strength_global_vars) = NULL;

// -- Erosion --

Expand Down
1 change: 1 addition & 0 deletions single-node-refactor/src/input/parse_yaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,7 @@ void parse_materials(Yaml::Node& root, Material_t& Materials)
break;

case model::userDefinedStrength:

RUN({
Materials.MaterialFunctions(mat_id).calc_stress = &UserDefinedStrengthModel::calc_stress;
});
Expand Down
5 changes: 3 additions & 2 deletions single-node-refactor/src/material_models/eos/gamma_law_eos.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ namespace GammaLawGasEOSModel {
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand All @@ -92,7 +93,7 @@ namespace GammaLawGasEOSModel {
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_state_vars,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand All @@ -113,7 +114,7 @@ namespace GammaLawGasEOSModel {
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_state_vars,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand Down
22 changes: 20 additions & 2 deletions single-node-refactor/src/material_models/eos/no_eos.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,31 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
///
/////////////////////////////////////////////////////////////////////////////
namespace NoEOSModel {

// host side function
static void initialize(const DCArrayKokkos<double>& MaterialPoints_pres,
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
const RaggedRightArrayKokkos<double> &eos_global_vars,
const size_t num_vars)
{



return;
} // end func

KOKKOS_FUNCTION
static void calc_pressure(const DCArrayKokkos<double>& MaterialPoints_pres,
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_state_vars,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand All @@ -74,7 +92,7 @@ namespace NoEOSModel {
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_state_vars,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand Down
46 changes: 42 additions & 4 deletions single-node-refactor/src/material_models/eos/user_defined_eos.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,30 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/////////////////////////////////////////////////////////////////////////////
namespace UserDefinedEOSModel
{
// host side function
static void initialize(const DCArrayKokkos<double>& MaterialPoints_pres,
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
const RaggedRightArrayKokkos<double> &eos_global_vars,
const size_t num_vars)
{



return;
} // end func

KOKKOS_FUNCTION
static void calc_pressure(const DCArrayKokkos<double>& MaterialPoints_pres,
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_state_vars,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand All @@ -88,7 +105,7 @@ namespace UserDefinedEOSModel
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_state_vars,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand Down Expand Up @@ -131,12 +148,30 @@ namespace UserDefinedEOSModel
// ------------------------------------------------------------------------------
namespace NotionalEOSModel {

// host side function
static void initialize(const DCArrayKokkos<double>& MaterialPoints_pres,
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
const RaggedRightArrayKokkos<double> &eos_global_vars,
const size_t num_vars)
{



return;
} // end func

KOKKOS_FUNCTION
static void calc_pressure(const DCArrayKokkos<double>& MaterialPoints_pres,
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_state_vars,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand All @@ -153,7 +188,7 @@ namespace NotionalEOSModel {
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_state_vars,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
Expand All @@ -169,4 +204,7 @@ namespace NotionalEOSModel {
} // end namespace





#endif // end Header Guard
58 changes: 38 additions & 20 deletions single-node-refactor/src/material_models/eos/void_eos.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,55 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/////////////////////////////////////////////////////////////////////////////
namespace VoidEOSModel {

// host side function
static void initialize(const DCArrayKokkos<double>& MaterialPoints_pres,
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
const RaggedRightArrayKokkos<double> &eos_global_vars,
const size_t num_vars)
{



return;
} // end func

KOKKOS_FUNCTION
static void calc_pressure(const DCArrayKokkos<double>& elem_pres,
const DCArrayKokkos<double>& elem_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& elem_state_vars,
const DCArrayKokkos<double>& elem_sspd,
const double den,
const double sie,
const RaggedRightArrayKokkos<double> &eos_global_vars)
static void calc_pressure(const DCArrayKokkos<double>& MaterialPoints_pres,
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
const RaggedRightArrayKokkos<double> &eos_global_vars)
{
// pressure of a void is 0
elem_pres(mat_pt_lid) = 0.0;
MaterialPoints_pres(mat_pt_lid) = 0.0;

return;
} // end func

KOKKOS_FUNCTION
static void calc_sound_speed(const DCArrayKokkos<double>& elem_pres,
const DCArrayKokkos<double>& elem_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& elem_state_vars,
const DCArrayKokkos<double>& elem_sspd,
const double den,
const double sie,
const RaggedRightArrayKokkos<double> &eos_global_vars)
static void calc_sound_speed(const DCArrayKokkos<double>& MaterialPoints_pres,
const DCArrayKokkos<double>& MaterialPoints_stress,
const size_t mat_pt_lid,
const size_t mat_id,
const DCArrayKokkos<double>& MaterialPoints_eos_state_vars,
const DCArrayKokkos<double>& MaterialPoints_sspd,
const double den,
const double sie,
const RaggedRightArrayKokkos<double> &eos_global_vars)
{

// sound speed of a void is 0, machine small must be used for CFL calculation
elem_sspd(mat_pt_lid) = 1.0e-32;
MaterialPoints_sspd(mat_pt_lid) = 1.0e-32;

return;
} // end func
Expand Down
Loading

0 comments on commit 92ade59

Please sign in to comment.