Skip to content

Commit

Permalink
LCM: rework kinematics and constittive model parameters
Browse files Browse the repository at this point in the history
Essentially create Evaluator interfaces to reduce the number of evaluators
that we are required to register.

Also change NeoHookean to Neohookean everywhere, because of reasons.
  • Loading branch information
jtostie committed Mar 11, 2013
1 parent 6edd0ea commit 3a49939
Show file tree
Hide file tree
Showing 33 changed files with 687 additions and 64 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ phalanx_graph
tags
*12
*13
*.save
2 changes: 1 addition & 1 deletion examples/KfieldBC/materials.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ParameterList name="TestMat">
<ParameterList name="Material Model">
<Parameter name="Model Name" type="string" value="NeoHookean"/>
<Parameter name="Model Name" type="string" value="Neohookean"/>
</ParameterList>
<ParameterList name="Elastic Modulus">
<Parameter name="Elastic Modulus Type" type="string" value="Constant"/>
Expand Down
4 changes: 2 additions & 2 deletions examples/Kfield_fracture/input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</ParameterList>

<ParameterList name = "Projection">
<Parameter name = "Projection Variable" type = "string" value="NeoHookean"/>
<Parameter name = "Projection Variable" type = "string" value="Neohookean"/>
<Parameter name = "Projection Rank" type = "int" value = "2"/>
<Parameter name = "Projection Comp" type = "int" value = "9"/>
</ParameterList>
Expand All @@ -37,7 +37,7 @@
</ParameterList>
<!-- MATERIAL MODEL/PROPERTIES -->
<ParameterList name="Material Model">
<Parameter name="Model Name" type="string" value="NeoHookean"/>
<Parameter name="Model Name" type="string" value="Neohookean"/>
</ParameterList>
<ParameterList name="Elastic Modulus">
<Parameter name="Elastic Modulus Type" type="string" value="Constant"/>
Expand Down
2 changes: 1 addition & 1 deletion examples/Mechanics/2materials.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<ParameterList name="Plastic">
<ParameterList name="Material Model">
<Parameter name="Model Name" type="string" value="NeoHookean"/>
<Parameter name="Model Name" type="string" value="Neohookean"/>
</ParameterList>
<ParameterList name="Elastic Modulus">
<Parameter name="Elastic Modulus Type" type="string" value="Constant"/>
Expand Down
2 changes: 1 addition & 1 deletion examples/NonlinearElasticity2D/inputAD.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Parameter name="DBC on NS NodeSet1 for DOF Y" type="double" value="0.3"/>
</ParameterList>
<ParameterList name="Material Model">
<Parameter name="Model Name" type="string" value="NeoHookean AD"/>
<Parameter name="Model Name" type="string" value="Neohookean AD"/>
</ParameterList>
<ParameterList name="Elastic Modulus">
<Parameter name="Elastic Modulus Type" type="string" value="Constant"/>
Expand Down
2 changes: 1 addition & 1 deletion examples/NonlinearElasticity3D/input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<Parameter name="Value" type="double" value="1.5"/>
</ParameterList>
<ParameterList name="Material Model">
<Parameter name="Model Name" type="string" value="NeoHookean"/>
<Parameter name="Model Name" type="string" value="Neohookean"/>
</ParameterList>
<ParameterList name="Poissons Ratio">
<Parameter name="Poissons Ratio Type" type="string" value="Constant"/>
Expand Down
2 changes: 1 addition & 1 deletion examples/SurfaceElement/3materials.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<ParameterList name="Plastic">
<ParameterList name="Material Model">
<Parameter name="Model Name" type="string" value="NeoHookean"/>
<Parameter name="Model Name" type="string" value="Neohookean"/>
</ParameterList>
<ParameterList name="Elastic Modulus">
<Parameter name="Elastic Modulus Type" type="string" value="Constant"/>
Expand Down
2 changes: 1 addition & 1 deletion examples/SurfaceElementAniso/3materials.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<ParameterList name="Hyper">
<ParameterList name="Material Model">
<Parameter name="Model Name" type="string" value="NeoHookean"/>
<Parameter name="Model Name" type="string" value="Neohookean"/>
</ParameterList>
<ParameterList name="Elastic Modulus">
<Parameter name="Elastic Modulus Type" type="string" value="Constant"/>
Expand Down
2 changes: 1 addition & 1 deletion examples/SurfaceElementNeck/1material.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ParameterList name="Plastic">
<ParameterList name="Material Model">
<Parameter name="Model Name" type="string" value="NeoHookean"/>
<Parameter name="Model Name" type="string" value="Neohookean"/>
</ParameterList>
<ParameterList name="Elastic Modulus">
<Parameter name="Elastic Modulus Type" type="string" value="Constant"/>
Expand Down
2 changes: 1 addition & 1 deletion examples/ThermoPoroMechanics3D/input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<!-- MATERIAL MODEL/PROPERTIES -->
<ParameterList name="Material Model">
<Parameter name="Model Name" type="string" value="NeoHookean"/>
<Parameter name="Model Name" type="string" value="Neohookean"/>
</ParameterList>

<!--Stabilization Parameter -->
Expand Down
6 changes: 6 additions & 0 deletions src/LCM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ SET(SOURCES ${SOURCES}
evaluators/TvergaardHutchinson.cpp
evaluators/SurfaceCohesiveResidual.cpp
evaluators/ConstitutiveModelInterface.cpp
evaluators/ConstitutiveModelParameters.cpp
evaluators/Kinematics.cpp
)

SET(HEADERS ${HEADERS}
Expand Down Expand Up @@ -325,6 +327,10 @@ SET(HEADERS ${HEADERS}
evaluators/SurfaceCohesiveResidual_Def.hpp
evaluators/ConstitutiveModelInterface.hpp
evaluators/ConstitutiveModelInterface_Def.hpp
evaluators/ConstitutiveModelParameters.hpp
evaluators/ConstitutiveModelParameters_Def.hpp
evaluators/Kinematics.hpp
evaluators/Kinematics_Def.hpp
)

#LCM models
Expand Down
7 changes: 4 additions & 3 deletions src/LCM/evaluators/ConstitutiveModelInterface_Def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ namespace LCM {
PHX::FieldManager<Traits>& fm)
{
TEUCHOS_TEST_FOR_EXCEPTION(dependent_fields_.size() == 0, std::logic_error,
"something is wrong in the CMI");
"something is wrong in the LCM::CMI");
TEUCHOS_TEST_FOR_EXCEPTION(evaluated_fields_.size() == 0, std::logic_error,
"something is wrong in the CMI");
"something is wrong in the LCM::CMI");
// dependent fields
typename std::vector<Teuchos::RCP<PHX::MDField<ScalarT> > >::iterator viter;
for ( viter = dependent_fields_.begin();
Expand Down Expand Up @@ -126,7 +126,8 @@ namespace LCM {
initializeModel(const Teuchos::ParameterList* p,
const Teuchos::RCP<Albany::Layouts>& dl)
{
std::string model_name = p->get<std::string>("Model Name");
std::string model_name =
p->sublist("Material Model").get<std::string>("Model Name");

if ( model_name == "Neohookean" ) {
this->model_ = Teuchos::rcp( new LCM::NeohookeanModel<EvalT,Traits>(p,dl) );
Expand Down
13 changes: 13 additions & 0 deletions src/LCM/evaluators/ConstitutiveModelParameters.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//*****************************************************************//
// Albany 2.0: Copyright 2012 Sandia Corporation //
// This Software is released under the BSD license detailed //
// in the file "license.txt" in the top-level Albany directory //
//*****************************************************************//

#include "PHAL_AlbanyTraits.hpp"

#include "ConstitutiveModelParameters.hpp"
#include "ConstitutiveModelParameters_Def.hpp"

PHAL_INSTANTIATE_TEMPLATE_CLASS(LCM::ConstitutiveModelParameters)

129 changes: 129 additions & 0 deletions src/LCM/evaluators/ConstitutiveModelParameters.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
//*****************************************************************//
// Albany 2.0: Copyright 2012 Sandia Corporation //
// This Software is released under the BSD license detailed //
// in the file "license.txt" in the top-level Albany directory //
//*****************************************************************//

#if !defined(LCM_ConstitutiveModelParameters_hpp)
#define LCM_ConstitutiveModelParameters_hpp

#include "Phalanx_ConfigDefs.hpp"
#include "Phalanx_Evaluator_WithBaseImpl.hpp"
#include "Phalanx_Evaluator_Derived.hpp"
#include "Phalanx_MDField.hpp"

#include "Teuchos_ParameterList.hpp"
#include "Epetra_Vector.h"
#include "Sacado_ParameterAccessor.hpp"
#include "Stokhos_KL_ExponentialRandomField.hpp"
#include "Teuchos_Array.hpp"
#include "Albany_Layouts.hpp"

namespace LCM {
///
/// \brief Evaluates a selecltion of Constitutive Model Parameters
/// Either as a constant or a truncated KL expansion.
///
template<typename EvalT, typename Traits>
class ConstitutiveModelParameters :
public PHX::EvaluatorWithBaseImpl<Traits>,
public PHX::EvaluatorDerived<EvalT, Traits>,
public Sacado::ParameterAccessor<EvalT, SPL_Traits> {

public:
typedef typename EvalT::ScalarT ScalarT;
typedef typename EvalT::MeshScalarT MeshScalarT;

///
/// Constructor
///
ConstitutiveModelParameters(Teuchos::ParameterList& p,
const Teuchos::RCP<Albany::Layouts>& dl);

///
/// Phalanx method to allocate space
///
void postRegistrationSetup(typename Traits::SetupData d,
PHX::FieldManager<Traits>& vm);

///
/// Implementation of physics
///
void evaluateFields(typename Traits::EvalData d);

///
/// Sacado method to access parameter values
///
ScalarT& getValue(const std::string &n);

///
/// Helper method to parse a parameter
///
void parseParameters(const std::string &n,
Teuchos::ParameterList &pl,
Teuchos::RCP<ParamLib> paramLib);

private:

///
/// Number of integration points
///
std::size_t num_pts_;

///
/// Number of spatial dimensions
///
std::size_t num_dims_;

///
/// spatial locations of integration points
///
PHX::MDField<MeshScalarT,Cell,QuadPoint,Dim> coord_vec_;

///
/// Constitutive Model Parameters
///
/// Elastic Moduli
PHX::MDField<ScalarT,Cell,QuadPoint> elastic_mod_;
PHX::MDField<ScalarT,Cell,QuadPoint> poissons_ratio_;
PHX::MDField<ScalarT,Cell,QuadPoint> bulk_mod_;
PHX::MDField<ScalarT,Cell,QuadPoint> shear_mod_;
/// Plasticity Parameters
PHX::MDField<ScalarT,Cell,QuadPoint> yield_strength_;
PHX::MDField<ScalarT,Cell,QuadPoint> hardening_mod_;

///
/// map of strings to specify parameter names to MDFields
///
std::map<std::string, PHX::MDField<ScalarT,Cell,QuadPoint> > field_map_;

///
/// map of flags to specify if a parameter is constant
///
std::map<std::string, bool> is_constant_map_;

///
/// map of strings to ScalarTs to specify constant values
///
std::map<std::string, ScalarT> constant_value_map_;

///
/// Optional dependence on Temperature
///
bool have_temperature_;
PHX::MDField<ScalarT,Cell,QuadPoint> temperature_;
std::map<std::string, RealType> dparam_dtemp_map_;
std::map<std::string, RealType> ref_temp_map_;

//! map of strings to exponential random fields
std::map<std::string, Teuchos::RCP< Stokhos::KL::ExponentialRandomField<MeshScalarT> > > exp_rf_kl_map_;

//! map of strings to Arrays of values of the random variables
std::map<std::string, Teuchos::Array<ScalarT> > rv_map_;

//! storing the DataLayouts
const Teuchos::RCP<Albany::Layouts>& dl_;
};
}

#endif
Loading

0 comments on commit 3a49939

Please sign in to comment.