Chopping/webcutting error with a large surface

Hello,

I have a complex surface generated by 161523 vertexes. The attached file ‘make_surface_big.jou’ is how this surface was created, which took ~ 3 days to read all the vertexes. The trelis file for the surface can be downloaded from the following link.
make_surface_big.jou (7.1 MB)
trelis file

I was trying to use one part of this surface to make a volume and chop another volume. The journal file is attached. However, it took ~4 days to run and finally gave an error message (attached). I tried to use ‘webcut’ and got similar error message (also attached).

create_geometry.jou (183 Bytes)



I’m confused because when I tried with a smaller surface it worked. Any help on how to create this geometry will be much appreciated. Also, any suggestions on making these operations faster? I’m using Coreform Cubit 2021.5 on a 2020 iMac (3.8 GHz 8-Core Intel Core i7 and 128 GB memory).

There are a few answers regarding performance here. In general, when you want to maximize performance, there are a few things to consider:

  1. Minimize all I/O, such as

    • The automatic writing to a journal file:
      journal off
      
    • “Writing” (printing) text to the terminal:
      echo off
      info off
      
  2. Minimize graphics rendering, this means either

    • Run Cubit from a terminal with -nographics option
    • Set the graphics tolerance to 15 degrees or larger.
      graphics tolerance angle 15
      
      Note that 15 degrees is the “optimal” render tolerance for accuracy and speed. Rendering times increase dramatically as you decrease from 15 degrees to 1 degree… see plot (time in seconds)
  3. VERY IMPORTANT Don’t run “very large” journal files that consist of the same command applied over-and-over to unique values of a dataset. Instead use Cubit-Python to apply instructions via various flow control and modern programming paradigms. For instance, instead of running a 160K line journal file, that consists primarily of commands similar to:

    create vertex 247.050000 496.800000 0.023590
    create vertex 248.400000 496.800000 0.023310
    create vertex 249.750000 496.800000 0.020210
    create vertex 251.100000 496.800000 0.019590
    create vertex 252.450000 496.800000 0.011210
    create vertex 253.800000 496.800000 0.004070
    create vertex 255.150000 496.800000 0.000620
    

    Write those vertex locations to a CSV file and use Cubit-Python to process them. For instance:

    def create_vertex_from_file(filename):
       f = open(filename)
       fLines = f.readlines()
       fLines = [line.strip() for line in fLines]
       f.close()
       for line in fLines:
          line = line.split(",")
          cubit.cmd(f"create vertex x {line[0]} y {line[1]} z {line[2]}")
    

Combining these three things together, here’s what I’d do to replace your make_surface_big.jou file:

def main(vertex_file, curve_file, offset):
  prepare_cubit()
  create_vertex_from_file(vertex_file)
  create_curve_from_file(curve_file)
  create_surface(offset)

def prepare_cubit():
  cubit.cmd("reset")
  cubit.cmd("echo off")
  cubit.cmd("journal off")
  cubit.cmd("info off")
  cubit.cmd("graphics tolerance 15")

def create_vertex_from_file(filename):
  print(f"Creating vertices from {filename}...")
  f = open(filename)
  fLines = f.readlines()
  fLines = [line.strip() for line in fLines]
  f.close()
  counter = 0
  line_count = 0
  for line in fLines:
    counter+=1
    line_count+=1
    line = line.split(",")
    cubit.cmd(f"create vertex x {line[0]} y {line[1]} z {line[2]}")
    if counter == 1000:
      counter = 0
      cubit.cmd("info on")
      print(f"Processed line {line_count} of {len(fLines)}")
      cubit.cmd("info off")
  cubit.cmd("info on")
  print("Done!")
  cubit.cmd("info off")

def create_curve_from_file(filename):
  cubit.cmd("info on")
  print(f"Creating curves using vertices from {filename}...")
  cubit.cmd("info off")
  f = open(filename)
  fLines = f.readlines()
  fLines = [line.strip() for line in fLines]
  f.close()
  for line in fLines:
    line = line.split(",")
    cubit.cmd(f"create curve spline location vertex {line[0]} to {line[1]} delete")
  cubit.cmd("info on")
  print("Done!")
  cubit.cmd("info off")

def create_surface(offset):
  cubit.cmd("info on")
  cubit.cmd("Creating shoreline surface model...")
  cubit.cmd("create surface skin curve all")
  cubit.cmd(f"webcut volume 1 with plane zplane offset {offset}")
  cubit.cmd("merge all")
  cubit.cmd("delete vertex all")
  cubit.cmd("delete curve all")
  print("Done!")
  cubit.cmd("info off")

if __name__=="__main__":
  vertex_file = r"C:\Users\Owner\Downloads\vertex_locations.csv"
  curve_file = r"C:\Users\Owner\Downloads\spline_vertices.csv"
  offset = -0.2
  main(vertex_file, curve_file, offset)

Notice how I’ve balanced the cost of printing to the terminal with progress reporting, via intentional use of print statements and info on / info off. Then I run this using my (Windows 10) terminal:

## POWERSHELL COMMAND
PS C:\Users\Owner> & 'C:\Program Files\Coreform Cubit 2021.5\bin\coreform_cubit.com' -nographics
## WAIT FOR CUBIT TO LOAD... THEN WHEN PROMPT APPEARS DO THE FOLLOWING:
### Add the path to the Python file I made above
import sys
sys.path.append(r"C:\Users\Owner\Downloads")
### Import the file 
import make_surface_big
### Set variables
vertex_file = r"C:\Users\Owner\Downloads\vertex_locations.csv"
curve_file = r"C:\Users\Owner\Downloads\spline_vertices.csv"
offset = -0.2
### Execute
make_surface_big.main(vertex_file, curve_file, offset)

vertex_locations.csv (3.5 MB)
spline_vertices.csv (5.2 KB)
make_surface_big.py (1.9 KB)

When all said and done the entire script runs in about 30 minutes, with most of the time spent in the webcut).

1 Like

Thanks for these tips. I don’t know python. Did you call Cubit directly in python? Any tutorials on this will be much appreciated.

Also I’m interested to know if chopping/webcutting works on your end. Thanks.

There are a couple ways to use Python with Cubit. The first is that you can run Python commands directly in Cubit using the Python command line tab:
image

or using the built-in Journal editor:

or from an external Python session:

A few notes:

Any update on the chopping/webcutting? Hope to resolve this issue soon. Thanks

I attempted to to use a webcut tool on this model. It for three days without completing. I didn’t wait for an error at that point.

  1. Working with splines is very expensive compared to analytic CAD. 160k spline vertices is astronomical. There’s very little that we can do to improve that performance - much of that is on the commercial solid modeling engine that we use, ACIS. We would suggest resampling the vertices to reduce the number of vertices to improve the performance.

  2. The volume overlap of the webcut you are attempting is very small in comparison to the overall model size. Couple that with 160k spline vertices and there are any number of reasons why it might fail.

Are you trying to create three volumes? It might be faster to project the shoreline curve on to the surfaces and create the volumes via bounding box or lofting.