Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ MAST::Examples::ThermalJacobianScaling::operator() (Real& val) const {

if (max_res > 0.)
max_log = std::log10(max_res);
val = std::fmax(1.-std::exp(_accel_factor*(log-max_log)), low);
val = std::fmax(std::pow(1-res/max_res, _accel_factor), low);
//libMesh::out << log << " " << max_log << " " << val << std::endl;
}
}
Expand Down
19 changes: 13 additions & 6 deletions src/elasticity/structural_element_1d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ MAST::StructuralElement1D::calculate_stress(bool request_derivative,
strain_3D = RealVectorX::Zero(6),
stress_3D = RealVectorX::Zero(6),
dstrain_dp = RealVectorX::Zero(n1),
dstress_dp = RealVectorX::Zero(n1);
dstress_dp = RealVectorX::Zero(n1),
vec1 = RealVectorX::Zero(n2),
vec2 = RealVectorX::Zero(n2);

MAST::FEMOperatorMatrix
Bmat_mem,
Expand Down Expand Up @@ -433,8 +435,12 @@ MAST::StructuralElement1D::calculate_stress(bool request_derivative,
dstress_dX = material_mat * dstrain_dX;

// copy to the 3D structure
dstress_dX_3D.row(0) = dstress_dX.row(0);
dstrain_dX_3D.row(0) = dstrain_dX.row(0);
vec1 = dstress_dX.row(0);
this->transform_vector_to_global_system(vec1, vec2);
dstress_dX_3D.row(0) = vec2;
vec1 = dstrain_dX.row(0);
this->transform_vector_to_global_system(vec1, vec2);
dstrain_dX_3D.row(0) = vec2;

if (request_derivative)
data->set_derivatives(dstress_dX_3D, dstrain_dX_3D);
Expand All @@ -461,7 +467,7 @@ MAST::StructuralElement1D::calculate_stress(bool request_derivative,
temp_func->derivative(*p, xyz[qp_loc_index], _time, dtemp);
ref_temp_func->derivative(*p, xyz[qp_loc_index], _time, dref_t);
alpha_func->derivative(*p, xyz[qp_loc_index], _time, dalpha);
dstrain_dp(0) -= alpha*(dtemp-dref_t) - dalpha*(temp-ref_t);
dstrain_dp(0) -= alpha*(dtemp-dref_t) + dalpha*(temp-ref_t);
}

// include the dependence of strain on the thickness
Expand Down Expand Up @@ -2098,7 +2104,7 @@ MAST::StructuralElement1D::thermal_residual_sensitivity (const MAST::FunctionBas
&temp_func = bc.get<MAST::FieldFunction<Real> >("temperature"),
&ref_temp_func = bc.get<MAST::FieldFunction<Real> >("ref_temperature");

Real t, t0, t_sens;
Real t, t0, t_sens, t0_sens;

for (unsigned int qp=0; qp<JxW.size(); qp++) {

Expand All @@ -2112,8 +2118,9 @@ MAST::StructuralElement1D::thermal_residual_sensitivity (const MAST::FunctionBas
temp_func(xyz[qp], _time, t);
temp_func.derivative(p, xyz[qp], _time, t_sens);
ref_temp_func(xyz[qp], _time, t0);
ref_temp_func.derivative(p, xyz[qp], _time, t0_sens);
delta_t(0) = t-t0;
delta_t_sens(0) = t_sens;
delta_t_sens(0) = t_sens-t0_sens;

// now prepare the membrane force sensitivity
vec1_n1 = material_exp_A_mat * delta_t_sens; // [C]{alpha (dT/dp)} (with membrane strain)
Expand Down
43 changes: 32 additions & 11 deletions src/elasticity/structural_element_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ MAST::StructuralElement2D::calculate_stress(bool request_derivative,
strain_3D = RealVectorX::Zero(6),
stress_3D = RealVectorX::Zero(6),
dstrain_dp = RealVectorX::Zero(n1),
dstress_dp = RealVectorX::Zero(n1);
dstress_dp = RealVectorX::Zero(n1),
vec1 = RealVectorX::Zero(n2),
vec2 = RealVectorX::Zero(n2);


FEMOperatorMatrix
Expand Down Expand Up @@ -526,12 +528,30 @@ MAST::StructuralElement2D::calculate_stress(bool request_derivative,
dstress_dX = material_mat * dstrain_dX;

// copy to the 3D structure
dstress_dX_3D.row(0) = dstress_dX.row(0); // sigma-xx
dstress_dX_3D.row(1) = dstress_dX.row(1); // sigma-yy
dstress_dX_3D.row(3) = dstress_dX.row(2); // tau-xy
dstrain_dX_3D.row(0) = dstrain_dX.row(0); // epsilon-xx
dstrain_dX_3D.row(1) = dstrain_dX.row(1); // epsilon-yy
dstrain_dX_3D.row(3) = dstrain_dX.row(2); // gamma-xy
// sigma-xx
vec1 = dstress_dX.row(0);
this->transform_vector_to_global_system(vec1, vec2);
dstress_dX_3D.row(0) = vec2;
// sigma-yy
vec1 = dstress_dX.row(1);
this->transform_vector_to_global_system(vec1, vec2);
dstress_dX_3D.row(1) = vec2;
// tau-xy
vec1 = dstress_dX.row(2);
this->transform_vector_to_global_system(vec1, vec2);
dstress_dX_3D.row(3) = vec2;
// epsilon-xx
vec1 = dstrain_dX.row(0);
this->transform_vector_to_global_system(vec1, vec2);
dstrain_dX_3D.row(0) = vec2;
// epsilon-yy
vec1 = dstrain_dX.row(1);
this->transform_vector_to_global_system(vec1, vec2);
dstrain_dX_3D.row(1) = vec2;
// gamma-xy
vec1 = dstrain_dX.row(2);
this->transform_vector_to_global_system(vec1, vec2);
dstrain_dX_3D.row(3) = vec2;

if (request_derivative)
data->set_derivatives(dstress_dX_3D, dstrain_dX_3D);
Expand Down Expand Up @@ -559,8 +579,8 @@ MAST::StructuralElement2D::calculate_stress(bool request_derivative,
temp_func->derivative(*p, xyz[qp_loc_index], _time, dtemp);
ref_temp_func->derivative(*p, xyz[qp_loc_index], _time, dref_t);
alpha_func->derivative(*p, xyz[qp_loc_index], _time, dalpha);
dstrain_dp(0) -= alpha*(dtemp-dref_t) - dalpha*(temp-ref_t); // epsilon-xx
dstrain_dp(1) -= alpha*(dtemp-dref_t) - dalpha*(temp-ref_t); // epsilon-yy
dstrain_dp(0) -= alpha*(dtemp-dref_t) + dalpha*(temp-ref_t); // epsilon-xx
dstrain_dp(1) -= alpha*(dtemp-dref_t) + dalpha*(temp-ref_t); // epsilon-yy
}


Expand Down Expand Up @@ -2715,7 +2735,7 @@ thermal_residual_sensitivity (const MAST::FunctionBase& p,
&temp_func = bc.get<MAST::FieldFunction<Real> >("temperature"),
&ref_temp_func = bc.get<MAST::FieldFunction<Real> >("ref_temperature");

Real t, t0, t_sens;
Real t, t0, t_sens, t0_sens;

for (unsigned int qp=0; qp<JxW.size(); qp++) {

Expand All @@ -2734,8 +2754,9 @@ thermal_residual_sensitivity (const MAST::FunctionBase& p,
temp_func(xyz[qp], _time, t);
temp_func.derivative(p, xyz[qp], _time, t_sens);
ref_temp_func(xyz[qp], _time, t0);
ref_temp_func.derivative(p, xyz[qp], _time, t0_sens);
delta_t(0) = t-t0;
delta_t_sens(0) = t_sens;
delta_t_sens(0) = t_sens-t0_sens;

// now prepare the membrane force sensitivity
vec1_n1 = material_exp_A_mat * delta_t_sens; // [C]{alpha dT/dp} (with membrane strain)
Expand Down