/comsol:comsolfrom comsol
Compiles and runs package-free Java against a live COMSOL Multiphysics server to inspect or modify models, set parameters, run studies, or build geometry.
Ships in comsol. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Inspect and modify the model that already lives on a COMSOL Multiphysics server. One interaction is one Java file: connect, read the model tag, change the model, disconnect.
Do not start a second COMSOL process. Do not call ModelUtil.initStandalone. Do not add Java packages or extra libraries.
On the first COMSOL-related task in a session, run from this skill directory:
node scripts/check-update.js
If the script prints a newer version, show the user those upgrade commands. Do not overwrite an installed copy unless they ask.
The server is already running. Same computer, any COMSOL license:
comsol mphserver -port 2036 -multi on
The first launch asks for a username, a password, and a confirmation. COMSOL stores that login. A later launch can add -login never and will not ask again. -multi on keeps the server up after disconnect. -login never with no stored login exits with Cannot find login information.
Default connection is localhost:2036. Override with COMSOL_HOST and COMSOL_PORT. When the server has a login, set both COMSOL_USER and COMSOL_PASSWORD. Set COMSOL_ROOT only when the install is not under /Applications/COMSOL*/Multiphysics or /usr/local/comsol*/multiphysics.
scripts/run-java.sh sits next to this file. Run it from the project root so the logs land in that project's comsol-api-runs/:
bash scripts/run-java.sh path/to/Interaction.java
The script copies the source into comsol-api-runs/<timestamp>-<ClassName>/ and writes:
<ClassName>.java — the source that was runcompile.log — comsol compile outputstdout.log — the Java program's stdout and stderrprogress.log — COMSOL progress (computation time, memory, degrees of freedom) from ModelUtil.showProgressRead stdout.log and progress.log before the next interaction. Do not edit a previous run directory.
Default package. File name equals the public class name. main receives host, port, absolute progress-log path, then optional user and password. The wrapper supplies those arguments.
Call sequence:
ModelUtil.connectModelUtil.showProgress(progressPath)ModelUtil.tags() as MODEL_TAG <tag>. If the list is empty, print NO_MODEL and exit 2, unless this interaction's task is to create or load a model.ModelUtil.disconnect() then System.exit, both inside finally. A server-side exception leaves non-daemon threads running and the client hangs if the process is allowed to return normally.import com.comsol.model.*;
import com.comsol.model.util.*;
public class SetParameter {
public static void main(String[] args) {
String host = args[0];
int port = Integer.parseInt(args[1]);
String progressPath = args[2];
if (args.length >= 5) {
ModelUtil.connect(host, port, args[3], args[4]);
} else {
ModelUtil.connect(host, port);
}
ModelUtil.showProgress(progressPath);
String[] tags = ModelUtil.tags();
if (tags.length == 0) {
System.out.println("NO_MODEL");
ModelUtil.disconnect();
System.exit(2);
}
String tag = tags[0];
Model model = ModelUtil.model(tag);
System.out.println("MODEL_TAG " + tag);
model.param().set("agent_probe", "42");
String value = model.param().get("agent_probe");
System.out.println("PARAM agent_probe=" + value);
ModelUtil.disconnect();
System.exit(0);
}
}
Before editing a node, print its feature tags (model.component().tags(), then the physics or geometry tags). Use tags copied from the model. Do not invent them.
When the user asks to create or change geometry, read model-card.md and follow it. Build only the fields the card contains. Do not invent a missing number, tag, physics interface, or material node.
A filled card is examples/layer-stack.md. New cards copy that shape. If the user has not provided a card, write one in that shape from the documents they named, show it, and build only after the numbers are on the card.
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (2p1c/comsol-skills) — no native marketplace selected
npx claudepluginhub p/2p1c-comsolOther plugins' skills for the same job