You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

68 lines
2.4 KiB

//
// Created by cflin on 6/12/23.
//
#ifndef TOP3D_THERMOELASTICTOP3D_H
#define TOP3D_THERMOELASTICTOP3D_H
#include "Top3d.h"
namespace da::sha::top {
class ThermoelasticTop3d {
public:
ThermoelasticTop3d(std::shared_ptr<Top3d> sp_mech_top3d, std::shared_ptr<Top3d> sp_thermal_top3d)
: sp_mech_top3d_(sp_mech_top3d), sp_thermal_top3d_(sp_thermal_top3d) {
Precompute();
}
Tensor3d TopOptMainLoop();
Eigen::VectorXd GetTemperature() const {
return sp_thermal_top3d_->GetU();
}
std::vector<Tensor3d> GetTensorOfStress(const Eigen::VectorXd &which_col_of_stress){
return sp_mech_top3d_->GetTensorOfStress(which_col_of_stress);
}
Tensor3d GetVonStress(){
return sp_mech_top3d_->GetVonStress();
}
private:
void Precompute() {
i_dFth_dT_ = Eigen::KroneckerProduct(
sp_thermal_top3d_->sp_mesh_->GetEleId2DofsMap(),
Eigen::VectorXi::Ones(sp_mech_top3d_->sp_mesh_->Get_DOFS_EACH_ELE()))
.transpose()
.reshaped();
j_dFth_dT_ = Eigen::KroneckerProduct(sp_mech_top3d_->sp_mesh_->GetEleId2DofsMap(),
Eigen::RowVectorXi::Ones(
sp_thermal_top3d_->sp_mesh_->Get_DOFS_EACH_ELE()))
.transpose()
.reshaped();
i_dFth_drho_ = (Eigen::VectorXi::LinSpaced(sp_mech_top3d_->sp_mesh_->GetNumEles(), 0,
sp_mech_top3d_->sp_mesh_->GetNumEles()) *
Eigen::RowVectorXi::Ones(sp_mech_top3d_->sp_mesh_->Get_DOFS_EACH_ELE())).transpose().reshaped();
j_dFth_drho_ = sp_mech_top3d_->sp_mesh_->GetEleId2DofsMap().transpose().reshaped();
D0_ = sp_mech_top3d_->sp_fea_->computeD(1.0);
const Eigen::MatrixXd Be = sp_mech_top3d_->sp_fea_->computeBe();
Inted_ = Be.transpose() * D0_ * (Eigen::VectorXd(6) << 1, 1, 1, 0, 0, 0).finished();
}
private:
std::shared_ptr<Top3d> sp_mech_top3d_, sp_thermal_top3d_;
private:
Eigen::VectorXi i_dFth_dT_, j_dFth_dT_;
Eigen::VectorXi i_dFth_drho_, j_dFth_drho_;
Eigen::VectorXd Inted_;
Eigen::MatrixXd D0_;
};
}
#endif //TOP3D_THERMOELASTICTOP3D_H