Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

small problem with code in Application Builder

Please login with a confirmed email address before reporting spam

Hallo everyone,

I want to write a function with application builder which could let "Set Geometry Parameter", "Geometry bild all", "mesh", "Study compute" and "report" runs in cycle.

following is my code:

for (int i=0;i<2;i+=1){
with(model.param());
set("X",0.04+0.01*i);
endwith();

model.geom("geom1").run("fin");
model.mesh("mesh1").run();
model.study("std2").run();

with(model.result().report("rpt2"));
set("filename","Z:\\Comsol 51\\Study2-"+i+".docx");
endwith();
model.result().report("rpt2").run();
}

With this code i want it runs like this:
set X=0.04—geometry build(for X=0.04)—mesh—compute study2(for X=0.04)—report(with name Study2-0, for X=0.04)

set X=0.05—geometry build(for X=0.05)—mesh—compute study2(for X=0.05)—report(with name Study2-1, for X=0.05)

2 Word files for Situation X=0.04 and X=0.05.

But after testing it runs like this:
set X=0.04—geometry build(for X=0.04)—mesh—compute study2(for X=0.04)

set X=0.05—geometry build(for X=0.05)—mesh—compute study2(for X=0.05)—report(with name Study2-0, for X=0.05)—report(with name Study2-1, for X=0.05)


According to the logfile i'm sure that both situation (X=0.04, X=0.05) are considered because the data are different.

I think the problem is , the Simulation (when X=0.04) ist correctly started but not reported, the Simulation (when X=0.05) also correctly started but twice reported.


Can someone help me?

Also tried with:
for(int i = 0;i<2;i+=1){
model.param().set("X",0.04+0.01*i);

model.geom("geom1").run("fin");
model.mesh("mesh1").run();
model.study("std2").run();

model.result().report("rpt2").set("filename","Z:\\Comsol 51\\Study2-"+i+".docx");
model.result().report("rpt2").run();
}

same problem.

Any help would be appreciated
Thanks~

1 Reply Last Post Jun 14, 2015, 3:11 p.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Jun 14, 2015, 3:11 p.m. EDT
up
up

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.