何在comsol中使用代码进行建模建立随机圆柱孔隙模型,但在完成的代码中出现以下错误为param未被定义。

在comsol中使用代码进行建模建立随机圆柱孔隙模型,但在完成的代码中出现以下错误为param未被定义。
请问有人可以帮我看一下该问题应该如何解决吗?
以下为建立孔隙的comsol代码:

model.component("comp1").geom("geom1").selection().remove("csel1");

model.component("comp1").geom("geom1").feature().clear();

model.component("comp1").geom("geom1").designBooleans(true);

model.component("comp1").geom("geom1").repairTolType("auto");



int NUMBER_OF_HOLES = 80; // 孔隙数量

double MIN_DISTANCE = 0.5; // 孔隙之间最小距离

double MAX_TRIES = 1000; // 最大尝试次数



double hx, hy, hz, hr = 0.0; // 孔隙位置及半径初始化

double FLAT_HEIGHT = 0.35; // 板厚

double FLAT_LENGTH = 0.25; // 板长

double FLAT_WIDTH = 8; // 板宽



model.component("comp1").geom("geom1").lengthUnit("mm");

model.component("comp1").geom("geom1").autoBuildNew(false);

model.component("comp1").geom("geom1").autoRebuild("off");

model.component("comp1").geom("geom1").selection().create("csel1", "CumulativeSelection");



model.component("comp1").geom("geom1").create("blk1", "Block");

model.component("comp1").geom("geom1").feature("blk1").set("size", new double[]{FLAT_LENGTH, FLAT_WIDTH, FLAT_HEIGHT});

model.component("comp1").geom("geom1").run("blk1");



int ind = 0;

while (ind < NUMBER_OF_HOLES)

{

  hx = hr+Math.random()*(FLAT_LENGTH-2*hr);

  hy = hr+Math.random()*(FLAT_WIDTH-2*hr);

  hz = Math.random()*0;

  hr = 0.02; // 孔隙半径

  

  boolean isValidHole = true;

  int tries = 0;

  

  while (isValidHole && tries < MAX_TRIES)

  {

    // Check if the current hole overlaps with any previous hole

    isValidHole = true;

    int holeInd = 0;

    while (holeInd < ind && isValidHole) {

      double dx = hx-model.component("comp1").geom("geom1").feature("cyl"+holeInd).param("pos").getReal(0);

      double dy = hy-model.component("comp1").geom("geom1").feature("cyl"+holeInd).param("pos").getReal(1);

      double dz = hy-model.component("comp1").geom("geom1").feature("cyl"+holeInd).param("pos").getReal(2);

      double distance = Math.sqrt(dx*dx+dy*dy+dz*dz);

      isValidHole = (distance > MIN_DISTANCE);

      holeInd++;

    }

    

    

    

    // If the current hole is valid, create it and exit the loop

    if (isValidHole) {

      model.component("comp1").geom("geom1").create("cyl"+ind, "Cylinder");

      model.component("comp1").geom("geom1").feature("cyl"+ind).set("pos", new double[]{hx, hy, hz});

      model.component("comp1").geom("geom1").feature("cyl"+ind).set("r", hr);

      model.component("comp1").geom("geom1").feature("cyl"+ind).set("h", FLAT_HEIGHT);

    }

  }

}

以下为发生错误的提示:

https://img-mid.csdnimg.cn/release/static/image/mid/ask/232194092186167.jpg "#left")