测量圆往往是我们进行后处理的工具,可以输出试样中的孔隙率、应力、应变率、配位数。
测量圆的布置是我们首先要做的事情,这里编写了一个可以在指定区域生成指定数目大小的测量圆,代码如下:
我们需要输入,测量圆生成区域的范围(x_min、x_max、y_min、y_max),还需要横向和竖向的数目(n_x、n_y),也需要半径(rad)。就可以自动生成测量圆了,这部分代码放于measure_tools文件中,之后在主程序中调用。
def create_measure(x_min,x_max,y_min,y_max,n_x,n_y,rad)if n_x=1 thensplit_x=0elsesplit_x=(x_max-x_min-2*rad)/float(n_x-1)endifif n_y=1 thensplit_y=0elsesplit_y=(y_max-y_min-2*rad)/float(n_y-1)endifloop local n(1,n_x)x_pos=x_min rad split_x*(n-1)loop local m(1,n_y)y_pos=y_min rad split_y*(m-1)commandmeasure create position [x_pos] [y_pos] radius [rad]endcommandendloopendloopend
这里用个demo测试一下,以昨天的成样结果为对象,生成20行1列的测量圆。
restore sample_brickcall measure_tools@create_measure([-width*0.1],[width*0.1],[-height*0.5],[height*0.5],1,20,[height*0.1])
结果为:

这里的参数可以自动调整,比如10行2列的测量圆:
restore sample_brickcall measure_tools@create_measure([-width*0.15],[width*0.15],[-height*0.5],[height*0.5],2,10,[height*0.1])

在measure_tools文件中编写了输出孔隙率表格的函数,可以将一行或者一列测量圆的孔隙率输出,这个功能后续还可以继续开发。
def get_poro_xtb_poro=table.create("poro")loop foreach mp measure.listtable(tb_poro,measure.pos.x(mp))=measure.porosity(mp)endloopenddef get_poro_ytb_poro=table.create("poro")loop foreach mp measure.listtable(tb_poro,measure.pos.y(mp))=measure.porosity(mp)endloopenddef get_poro_xytb_poro=table.create("poro")tb_x_pos=table.create("x_pos")tb_y_pos=table.create("y_pos")loop foreach mp measure.listtable(tb_poro,measure.id(mp))=measure.porosity(mp)endlooploop foreach mp measure.listtable(tb_x_pos,measure.id(mp))=measure.pos.x(mp)endlooploop foreach mp measure.listtable(tb_y_pos,measure.id(mp))=measure.pos.y(mp)endloopend
主程序为:
restore sample_brickcall measure_tools@create_measure([-width*0.1],[width*0.1],[-height*0.5],[height*0.5],1,20,[height*0.1])@get_poro_y
结果显示table:

这里的绿色线就是孔隙率随着y坐标的变化。
将table输出csv,把昨天的成样结果绘制一张图,结果为,可以看出来不光是视觉效果,孔隙率分布上分层压缩法都是比较好的。

将测量圆满布于试样中最后输出坐标和孔隙率:
restore sample_generate_1_4call measure_tools@create_measure([-width*0.5],[width*0.5],[-height*0.5],[height*0.5],20,20,[height*0.1])@get_poro_xy
如图:

输出在origin中绘制三维图:

当然云图也直观一点:

这个是分层压缩法的孔隙率分布情况,感觉这个规律还是比较复杂的,所以某些学者提出的某些准则是否适用还需要打个问号。