Working with Methods > Overview > The Method Nodes and Method Editor Windows

The Method Nodes and Method Editor Windows
The Method node () contains a user-defined method. To add a new Method node, right-click the Methods node and choose New Method or click the New Method button on the ribbon toolbar. In the New Method dialog box that opens, type a label for the method in the Name field. To edit the method, double-click the Method node, or right-click it and choose Edit (). An editor window then opens where you can edit the code for the method. Depending on the View all code preference setting, you see just the method declarations or the full class. In the editor you can highlight part of the code and right-click to cut, copy, paste, and delete it. You can also use the standard keyboard shortcuts such as Ctrl+C to copy, Ctrl+A to select all code in the editor window, and the Delete button. The code extends a Java class called ApplicationMethod that only requires one method with the following signature:
public void execute() {
  model.physics("es").feature("ccn1").set("ConstitutiveRelationD", 1,
model.modelData().getString("dielectricModel"));
}
This method can perform any operations available to the COMSOL API. There are a number of methods and members available through the extended class, the most important of which is the model object accessible as the member model. The code example above reads a data field named dielectricModel from the application’s own data (in an Electrostatics interface) and sets it to a parameter of a physics feature in the embedded model.
See The Method Node for information about the inputs and outputs that you can add in the Settings window.