Line data Source code
1 : #ifndef BC_OPERATOR_ELASTIC_TENSIONTEST_H 2 : #define BC_OPERATOR_ELASTIC_TENSIONTEST_H 3 : 4 : // #include "Operator/Elastic.H" 5 : #include "Constant.H" 6 : 7 : namespace BC 8 : { 9 : namespace Operator 10 : { 11 : namespace Elastic 12 : { 13 : class TensionTest : public Constant 14 : { 15 : public: 16 : static constexpr const char* name = "tensiontest"; 17 : 18 8 : TensionTest(): Constant() 19 8 : {}; 20 : 21 8 : TensionTest(IO::ParmParse &pp, std::string name) : TensionTest() 22 8 : { pp_queryclass(name,*this); } 23 : 24 : 25 0 : ~TensionTest() {}; 26 : 27 : using Constant::Init; 28 : using Constant::operator(); 29 : using Constant::set; 30 : 31 : enum LoadingMode {TRAC,DISP}; 32 : 33 : public: 34 8 : static void Parse(TensionTest & value, IO::ParmParse & pp) 35 : { 36 16 : std::string type = "uniaxial_stress_clamp"; 37 24 : std::string disp = "0.0", trac = "0.0"; 38 : LoadingMode mode; 39 : 40 8 : pp_query("type",type); // Tension test type. (Only option right now is :code:`uniaxial_stress_clamp`) 41 : 42 8 : if (pp.contains("trac") && pp.contains("disp")) 43 0 : Util::Abort(INFO,"Cannot specify both trac and disp"); 44 8 : else if (pp.contains("disp")) 45 : { 46 8 : pp_query("disp",disp); // Applied displacement (can be interpolator) 47 8 : mode = LoadingMode::DISP; 48 : } 49 0 : else if (pp.contains("trac")) 50 : { 51 0 : pp_query("trac",trac); // Applied traction (can be interpolator) 52 0 : mode = LoadingMode::TRAC; 53 : } 54 : else 55 0 : Util::Abort(INFO,"You must specify either trac or disp"); 56 : 57 8 : if (type == "uniaxial_stress_clamp") 58 : { 59 : // Add a X displacement in the X direction 60 0 : value.m_bc_val[Face::XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 61 0 : value.m_bc_val[Face::XHI_YLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 62 0 : value.m_bc_val[Face::XHI_YHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 63 : #if AMREX_SPACEDIM==3 64 0 : value.m_bc_val[Face::ZLO_XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 65 0 : value.m_bc_val[Face::ZHI_XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 66 0 : value.m_bc_val[Face::XHI_YLO_ZLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 67 0 : value.m_bc_val[Face::XHI_YLO_ZHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 68 0 : value.m_bc_val[Face::XHI_YHI_ZLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 69 0 : value.m_bc_val[Face::XHI_YHI_ZHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 70 : #endif 71 : 72 : // Set the Y faces, Z faces, and YZ edges to be traction-free 73 0 : for (int i = 0 ; i < AMREX_SPACEDIM ; i++) 74 : { 75 0 : value.m_bc_type[Face::YLO][i] = Type::Traction; 76 0 : value.m_bc_type[Face::YHI][i] = Type::Traction; 77 : #if AMREX_SPACEDIM==3 78 0 : value.m_bc_type[Face::ZLO][i] = Type::Traction; 79 0 : value.m_bc_type[Face::ZHI][i] = Type::Traction; 80 0 : value.m_bc_type[Face::YLO_ZLO][i] = Type::Traction; 81 0 : value.m_bc_type[Face::YHI_ZLO][i] = Type::Traction; 82 0 : value.m_bc_type[Face::YLO_ZHI][i] = Type::Traction; 83 0 : value.m_bc_type[Face::YHI_ZHI][i] = Type::Traction; 84 : #endif 85 : } 86 : } 87 8 : else if (type == "uniaxial_kolsky") 88 : { 89 : // Add a X displacement in the X direction 90 0 : value.m_bc_val[Face::XLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 91 0 : value.m_bc_val[Face::XLO_YLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 92 0 : value.m_bc_val[Face::XLO_YHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 93 : // Set the Y faces, Z faces, and YZ edges to be traction-free 94 0 : for (int i = 0 ; i < AMREX_SPACEDIM ; i++) 95 : { 96 0 : value.m_bc_type[Face::YLO][i] = Type::Traction; 97 0 : value.m_bc_type[Face::YHI][i] = Type::Traction; 98 : } 99 : } 100 8 : else if (type == "uniaxial_stress") 101 : { 102 : // Go ahead and set everything to traction first. 103 126 : for (int face = 0; face < m_nfaces; face++) 104 432 : for (int i = 0; i < AMREX_SPACEDIM; i++) 105 314 : value.m_bc_type[face][i] = Type::Traction; 106 : 107 : 108 : // Fix the X displacement in the XMIN 109 8 : value.m_bc_type[Face::XLO][0] = Type::Displacement; 110 8 : value.m_bc_type[Face::XLO_YLO][0] = Type::Displacement; 111 8 : value.m_bc_type[Face::XLO_YHI][0] = Type::Displacement; 112 : #if AMREX_SPACEDIM == 3 113 3 : value.m_bc_type[Face::ZLO_XLO][0] = Type::Displacement; 114 3 : value.m_bc_type[Face::ZHI_XLO][0] = Type::Displacement; 115 3 : value.m_bc_type[Face::XLO_YLO_ZLO][0] = Type::Displacement; 116 3 : value.m_bc_type[Face::XLO_YLO_ZHI][0] = Type::Displacement; 117 3 : value.m_bc_type[Face::XLO_YHI_ZLO][0] = Type::Displacement; 118 3 : value.m_bc_type[Face::XLO_YHI_ZHI][0] = Type::Displacement; 119 : #endif 120 : 121 : // Add a X displacement in the X direction (same as above) 122 8 : if (mode == TensionTest::LoadingMode::DISP) 123 : { 124 8 : value.m_bc_type[Face::XHI][0] = Type::Displacement; 125 8 : value.m_bc_val [Face::XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 126 8 : value.m_bc_type[Face::XHI_YLO][0] = Type::Displacement; 127 8 : value.m_bc_val [Face::XHI_YLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 128 8 : value.m_bc_type[Face::XHI_YHI][0] = Type::Displacement; 129 8 : value.m_bc_val [Face::XHI_YHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 130 : } 131 0 : else if (mode == TensionTest::LoadingMode::TRAC) 132 : { 133 0 : value.m_bc_type[Face::XHI][0] = Type::Traction; 134 0 : value.m_bc_val [Face::XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(trac); 135 0 : value.m_bc_type[Face::XHI_YLO][0] = Type::Traction; 136 0 : value.m_bc_val [Face::XHI_YLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(trac); 137 0 : value.m_bc_type[Face::XHI_YHI][0] = Type::Traction; 138 0 : value.m_bc_val [Face::XHI_YHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(trac); 139 : } 140 : #if AMREX_SPACEDIM == 3 141 3 : if (mode == TensionTest::LoadingMode::DISP) 142 : { 143 3 : value.m_bc_type[Face::ZLO_XHI][0] = Type::Displacement; 144 3 : value.m_bc_val [Face::ZLO_XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 145 3 : value.m_bc_type[Face::ZHI_XHI][0] = Type::Displacement; 146 3 : value.m_bc_val [Face::ZHI_XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 147 3 : value.m_bc_type[Face::XHI_YLO_ZLO][0] = Type::Displacement; 148 3 : value.m_bc_val [Face::XHI_YLO_ZLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 149 3 : value.m_bc_type[Face::XHI_YLO_ZHI][0] = Type::Displacement; 150 3 : value.m_bc_val [Face::XHI_YLO_ZHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 151 3 : value.m_bc_type[Face::XHI_YHI_ZLO][0] = Type::Displacement; 152 3 : value.m_bc_val [Face::XHI_YHI_ZLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 153 3 : value.m_bc_type[Face::XHI_YHI_ZHI][0] = Type::Displacement; 154 3 : value.m_bc_val [Face::XHI_YHI_ZHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 155 : } 156 3 : if (mode == TensionTest::LoadingMode::TRAC) 157 : { 158 0 : value.m_bc_type[Face::ZLO_XHI][0] = Type::Traction; 159 0 : value.m_bc_val [Face::ZLO_XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(trac); 160 0 : value.m_bc_type[Face::ZHI_XHI][0] = Type::Traction; 161 0 : value.m_bc_val [Face::ZHI_XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(trac); 162 0 : value.m_bc_type[Face::XHI_YLO_ZLO][0] = Type::Traction; 163 0 : value.m_bc_val [Face::XHI_YLO_ZLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(trac); 164 0 : value.m_bc_type[Face::XHI_YLO_ZHI][0] = Type::Traction; 165 0 : value.m_bc_val [Face::XHI_YLO_ZHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(trac); 166 0 : value.m_bc_type[Face::XHI_YHI_ZLO][0] = Type::Traction; 167 0 : value.m_bc_val [Face::XHI_YHI_ZLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(trac); 168 0 : value.m_bc_type[Face::XHI_YHI_ZHI][0] = Type::Traction; 169 0 : value.m_bc_val [Face::XHI_YHI_ZHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(trac); 170 : } 171 : #endif 172 : 173 : // Fix Ymin displacement 174 8 : value.m_bc_type[Face::YLO][1] = Type::Displacement; 175 8 : value.m_bc_type[Face::XLO_YLO][1] = Type::Displacement; 176 8 : value.m_bc_type[Face::XHI_YLO][1] = Type::Displacement; 177 : #if AMREX_SPACEDIM == 3 178 3 : value.m_bc_type[Face::YLO_ZLO][1] = Type::Displacement; 179 3 : value.m_bc_type[Face::YLO_ZHI][1] = Type::Displacement; 180 3 : value.m_bc_type[Face::XLO_YLO_ZLO][1] = Type::Displacement; 181 3 : value.m_bc_type[Face::XLO_YLO_ZHI][1] = Type::Displacement; 182 3 : value.m_bc_type[Face::XHI_YLO_ZLO][1] = Type::Displacement; 183 3 : value.m_bc_type[Face::XHI_YLO_ZHI][1] = Type::Displacement; 184 : #endif 185 : 186 : #if AMREX_SPACEDIM == 3 187 : // Fix Zmin displacement 188 3 : value.m_bc_type[Face::ZLO][2] = Type::Displacement; 189 3 : value.m_bc_type[Face::YLO_ZLO][2] = Type::Displacement; 190 3 : value.m_bc_type[Face::YHI_ZLO][2] = Type::Displacement; 191 3 : value.m_bc_type[Face::ZLO_XLO][2] = Type::Displacement; 192 3 : value.m_bc_type[Face::ZLO_XHI][2] = Type::Displacement; 193 3 : value.m_bc_type[Face::XLO_YLO_ZLO][2] = Type::Displacement; 194 3 : value.m_bc_type[Face::XLO_YHI_ZLO][2] = Type::Displacement; 195 3 : value.m_bc_type[Face::XHI_YLO_ZLO][2] = Type::Displacement; 196 3 : value.m_bc_type[Face::XHI_YHI_ZLO][2] = Type::Displacement; 197 : #endif 198 : 199 : } 200 0 : else if (type == "uniaxial_strain") 201 : { 202 : // Go ahead and set everything to traction first. 203 0 : for (int face = 0; face < m_nfaces; face++) 204 0 : for (int i = 0; i < AMREX_SPACEDIM; i++) 205 0 : value.m_bc_type[face][i] = Type::Traction; 206 : 207 : 208 : // Fix the X displacement in the XMIN 209 0 : value.m_bc_type[Face::XLO][0] = Type::Displacement; 210 0 : value.m_bc_type[Face::XLO_YLO][0] = Type::Displacement; 211 0 : value.m_bc_type[Face::XLO_YHI][0] = Type::Displacement; 212 : #if AMREX_SPACEDIM == 3 213 0 : value.m_bc_type[Face::ZLO_XLO][0] = Type::Displacement; 214 0 : value.m_bc_type[Face::ZHI_XLO][0] = Type::Displacement; 215 0 : value.m_bc_type[Face::XLO_YLO_ZLO][0] = Type::Displacement; 216 0 : value.m_bc_type[Face::XLO_YLO_ZHI][0] = Type::Displacement; 217 0 : value.m_bc_type[Face::XLO_YHI_ZLO][0] = Type::Displacement; 218 0 : value.m_bc_type[Face::XLO_YHI_ZHI][0] = Type::Displacement; 219 : #endif 220 : 221 : // Add a X displacement in the X direction (same as above) 222 0 : value.m_bc_type[Face::XHI][0] = Type::Displacement; 223 0 : value.m_bc_val [Face::XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 224 0 : value.m_bc_type[Face::XHI_YLO][0] = Type::Displacement; 225 0 : value.m_bc_val [Face::XHI_YLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 226 0 : value.m_bc_type[Face::XHI_YHI][0] = Type::Displacement; 227 0 : value.m_bc_val [Face::XHI_YHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 228 : #if AMREX_SPACEDIM == 3 229 0 : value.m_bc_type[Face::ZLO_XHI][0] = Type::Displacement; 230 0 : value.m_bc_val [Face::ZLO_XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 231 0 : value.m_bc_type[Face::ZHI_XHI][0] = Type::Displacement; 232 0 : value.m_bc_val [Face::ZHI_XHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 233 0 : value.m_bc_type[Face::XHI_YLO_ZLO][0] = Type::Displacement; 234 0 : value.m_bc_val [Face::XHI_YLO_ZLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 235 0 : value.m_bc_type[Face::XHI_YLO_ZHI][0] = Type::Displacement; 236 0 : value.m_bc_val [Face::XHI_YLO_ZHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 237 0 : value.m_bc_type[Face::XHI_YHI_ZLO][0] = Type::Displacement; 238 0 : value.m_bc_val [Face::XHI_YHI_ZLO][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 239 0 : value.m_bc_type[Face::XHI_YHI_ZHI][0] = Type::Displacement; 240 0 : value.m_bc_val [Face::XHI_YHI_ZHI][0] = Numeric::Interpolator::Linear<Set::Scalar>(disp); 241 : #endif 242 : 243 : // Fix Ymin displacement 244 0 : value.m_bc_type[Face::YLO][1] = Type::Displacement; 245 0 : value.m_bc_type[Face::XLO_YLO][1] = Type::Displacement; 246 0 : value.m_bc_type[Face::XHI_YLO][1] = Type::Displacement; 247 0 : value.m_bc_type[Face::YHI][1] = Type::Displacement; 248 0 : value.m_bc_type[Face::XLO_YHI][1] = Type::Displacement; 249 0 : value.m_bc_type[Face::XHI_YHI][1] = Type::Displacement; 250 : #if AMREX_SPACEDIM == 3 251 0 : value.m_bc_type[Face::YLO_ZLO][1] = Type::Displacement; 252 0 : value.m_bc_type[Face::YLO_ZHI][1] = Type::Displacement; 253 0 : value.m_bc_type[Face::YHI_ZLO][1] = Type::Displacement; 254 0 : value.m_bc_type[Face::YHI_ZHI][1] = Type::Displacement; 255 0 : value.m_bc_type[Face::XLO_YLO_ZLO][1] = Type::Displacement; 256 0 : value.m_bc_type[Face::XLO_YLO_ZHI][1] = Type::Displacement; 257 0 : value.m_bc_type[Face::XHI_YLO_ZLO][1] = Type::Displacement; 258 0 : value.m_bc_type[Face::XHI_YLO_ZHI][1] = Type::Displacement; 259 0 : value.m_bc_type[Face::XLO_YHI_ZLO][1] = Type::Displacement; 260 0 : value.m_bc_type[Face::XLO_YHI_ZHI][1] = Type::Displacement; 261 0 : value.m_bc_type[Face::XHI_YHI_ZLO][1] = Type::Displacement; 262 0 : value.m_bc_type[Face::XHI_YHI_ZHI][1] = Type::Displacement; 263 : #endif 264 : 265 : #if AMREX_SPACEDIM == 3 266 0 : value.m_bc_type[Face::ZLO][2] = Type::Displacement; 267 0 : value.m_bc_type[Face::ZHI][2] = Type::Displacement; 268 0 : value.m_bc_type[Face::YLO_ZLO][2] = Type::Displacement; 269 0 : value.m_bc_type[Face::YHI_ZLO][2] = Type::Displacement; 270 0 : value.m_bc_type[Face::ZLO_XLO][2] = Type::Displacement; 271 0 : value.m_bc_type[Face::ZLO_XHI][2] = Type::Displacement; 272 0 : value.m_bc_type[Face::YLO_ZHI][2] = Type::Displacement; 273 0 : value.m_bc_type[Face::YHI_ZHI][2] = Type::Displacement; 274 0 : value.m_bc_type[Face::ZHI_XLO][2] = Type::Displacement; 275 0 : value.m_bc_type[Face::ZHI_XHI][2] = Type::Displacement; 276 0 : value.m_bc_type[Face::XLO_YLO_ZLO][2] = Type::Displacement; 277 0 : value.m_bc_type[Face::XLO_YHI_ZLO][2] = Type::Displacement; 278 0 : value.m_bc_type[Face::XHI_YLO_ZLO][2] = Type::Displacement; 279 0 : value.m_bc_type[Face::XHI_YHI_ZLO][2] = Type::Displacement; 280 0 : value.m_bc_type[Face::XLO_YLO_ZHI][2] = Type::Displacement; 281 0 : value.m_bc_type[Face::XLO_YHI_ZHI][2] = Type::Displacement; 282 0 : value.m_bc_type[Face::XHI_YLO_ZHI][2] = Type::Displacement; 283 0 : value.m_bc_type[Face::XHI_YHI_ZHI][2] = Type::Displacement; 284 : #endif 285 : 286 : } 287 : else 288 : { 289 0 : Util::Abort(INFO,"Unknown BC type ", type); 290 : } 291 8 : } 292 : }; 293 : } 294 : } 295 : } 296 : #endif