Get the plot data in comsol application program

Comsol is good at post processing and visualization. However some special analysis is necessary in the comsol application program. For example, determine to mode number in special direction after a eigen mode analysis. The comsol can plot the electrical field along a line but it doesn’t tell the mode number. We have to write some code in the application to get the mode number according the electrical field. How to get the plot data from the comsol plot object?

The build methods getVertices, get Elements and getData don’t return the plot data in the plot points format. So, it is very difficult to get the plot data. The 1D plot data can export to a table. Then read double array from the table. Finally don’t forget to delete the table for the next time to create it. Here is the code

    model.result("pg3").feature("lngr1").createTable("tbl3");
    double[][] tab = model.result().table("tbl3").getReal();
    model.result().table().remove("tbl3");

The first column of tab is x and the second column is y.

Leave a Comment