2382 std::ofstream pos_file;
2383 std::ofstream neg_file;
2385 filename << doc_info.directory() <<
"/pos_principal_stress"
2386 << doc_info.number() <<
".dat";
2387 pos_file.open(
filename.str().c_str());
2389 filename << doc_info.directory() <<
"/neg_principal_stress"
2390 << doc_info.number() <<
".dat";
2391 neg_file.open(
filename.str().c_str());
2394 pos_file << 0.0 <<
" " << 0.0 <<
" " << 0.0 <<
" " << 0.0 <<
" "
2396 neg_file << 0.0 <<
" " << 0.0 <<
" " << 0.0 <<
" " << 0.0 <<
" "
2400 Vector<double>
s(2);
2401 Vector<double>
x(2);
2404 unsigned n_solid_element = mesh_pt->nelement();
2405 for (
unsigned e = 0;
e < n_solid_element;
e++)
2407 ELEMENT* el_pt =
dynamic_cast<ELEMENT*
>(mesh_pt->element_pt(
e));
2411 Vector<double> principal_stress(2);
2412 el_pt->get_principal_stress(
2413 s, principal_stress_vector, principal_stress);
2416 el_pt->interpolated_x(
s,
x);
2421 bool hydrostat =
false;
2425 double dev_max = 1.0e-2;
2426 if (principal_stress[0] != 0.0)
2428 if (
std::fabs((principal_stress[0] - principal_stress[1]) /
2429 principal_stress[0]) < dev_max)
2432 double Cos =
cos(0.25 * 3.14159);
2433 double Sin =
sin(0.25 * 3.14159);
2434 rot(0, 0) = Cos * principal_stress_vector(0, 0) -
2435 Sin * principal_stress_vector(0, 1);
2436 rot(0, 1) = Sin * principal_stress_vector(0, 0) +
2437 Cos * principal_stress_vector(0, 1);
2438 rot(1, 0) = Cos * principal_stress_vector(1, 0) -
2439 Sin * principal_stress_vector(1, 1);
2440 rot(1, 1) = Sin * principal_stress_vector(1, 0) +
2441 Cos * principal_stress_vector(1, 1);
2446 for (
unsigned i = 0;
i < 2;
i++)
2448 if (principal_stress[
i] > 0.0)
2450 pos_file <<
x[0] <<
" " <<
x[1] <<
" "
2451 << principal_stress_vector(
i, 0) <<
" "
2452 << principal_stress_vector(
i, 1) << std::endl;
2453 pos_file <<
x[0] <<
" " <<
x[1] <<
" "
2454 << -principal_stress_vector(
i, 0) <<
" "
2455 << -principal_stress_vector(
i, 1) << std::endl;
2458 pos_file <<
x[0] <<
" " <<
x[1] <<
" " <<
rot(
i, 0) <<
" "
2459 <<
rot(
i, 1) << std::endl;
2460 pos_file <<
x[0] <<
" " <<
x[1] <<
" " << -
rot(
i, 0) <<
" "
2461 << -
rot(
i, 1) << std::endl;
2466 neg_file <<
x[0] <<
" " <<
x[1] <<
" "
2467 << principal_stress_vector(
i, 0) <<
" "
2468 << principal_stress_vector(
i, 1) << std::endl;
2469 neg_file <<
x[0] <<
" " <<
x[1] <<
" "
2470 << -principal_stress_vector(
i, 0) <<
" "
2471 << -principal_stress_vector(
i, 1) << std::endl;
2474 neg_file <<
x[0] <<
" " <<
x[1] <<
" " <<
rot(
i, 0) <<
" "
2475 <<
rot(
i, 1) << std::endl;
2476 neg_file <<
x[0] <<
" " <<
x[1] <<
" " << -
rot(
i, 0) <<
" "
2477 << -
rot(
i, 1) << std::endl;
AnnoyingScalar cos(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:136
AnnoyingScalar sin(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:137
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RealScalar s
Definition: level1_cplx_impl.h:130
EIGEN_BLAS_FUNC() rot(int *n, Scalar *px, int *incx, Scalar *py, int *incy, Scalar *pc, Scalar *ps)
Definition: level1_real_impl.h:88
string filename
Definition: MergeRestartFiles.py:39
Real fabs(const Real &a)
Definition: boostmultiprec.cpp:117
list x
Definition: plotDoE.py:28