文章目录
前言
只是为方便学习,不做其他用途。
时间:2023.02.20
细化后的结果和仿真结果相比误差更大了
将老师给的B样条基函数换成了gismo库中的基函数(本来想的是可能老师的基函数程序出问题了,结果是我想多了),两个单元的等几何结果一致
本文用于存储:用gismo库中的基函数处理等几何(没有细化)
一、需要添加gismo库程序才能运行
1.1 主程序文件
#include<iostream>
#include <gismo.h>
#include <Eigen/Dense>
using namespace Eigen;
using namespace gismo;
using namespace std;
#include <vector>
#include "nurbs_uniformRefine.h"
#include "IGA_Plate.h"
//初始物理量
int IGA_Plate::p = 2;
double IGA_Plate::E = 10; // 弹性模量
double IGA_Plate::mu = 0.3; // 泊松比
double IGA_Plate::t = 0.01; // 厚度
// 细化前的初始物理量
MatrixXd Node_Matrix()
{
MatrixXd Node(12, 2);
Node << 0, 0,
0, 1,
0, 2,
0.5, 0,
0.5, 1,
0.5, 2,
1.5, 0,
1.5, 1,
1.5, 2,
2, 0,
2, 1,
2, 2;
return Node;
}
MatrixXd k_Refine::pre_Node = Node_Matrix(); //节点信息矩阵
MatrixXd ele_Matrix()
{
MatrixXd ele(2, 9);
ele << 1, 2, 3, 4, 5, 6, 7, 8, 9,
4, 5, 6, 7, 8, 9, 10, 11, 12;
return ele;
}
MatrixXd IGA_Plate::Node = Node_Matrix();
MatrixXd IGA_Plate::ele = ele_Matrix(); //注意:单元编号是整型数据 数据类型要统一
// 数据类型最后我都统一改成了double型了 本来 ele 想要用 int型, 发现得改好多之前写的IGA里面的东西,就用int型了
gsKnotVector<> IGA_Plate::U(0, 1, 1, 3); //节点向量
gsKnotVector<> IGA_Plate::V(0, 1, 0, 3);
// 输出向量的各个值
void Print_Vector(vector<double> U)
{
cout << " 向量值 " << " = " << endl;
for (int i = 0; i < U.size(); i++)
{
cout << " " << U[i] << " " ;
}
cout << endl;
}
// 输出矩阵的各个值
void Print(MatrixXd K)
{
for (int j = 0; j < K.rows(); j++)
{
for (int i = 0; i < K.cols(); i++)
{
cout << K(j, i) << " ";
}
cout << endl;
}
}
int main()
{
IGA_Plate iga_2d;
// 组装刚度矩阵
int num_GK = iga_2d.ele.rows() * iga_2d.Node.rows(); //总刚的大小 2*12
MatrixXd Gk(num_GK, num_GK);
Gk.setZero();
Gk = iga_2d.IGA_Assembly();
// 载荷向量
VectorXd F(num_GK);
F.setZero();
F(18) = 1.0 / 3;
F(20)