/* * full_tpc.java */ import com.comsol.model.*; import com.comsol.model.util.*; import java.io.*; import java.util.Arrays; import java.util.List; import java.util.ArrayList; import java.util.Vector; import java.util.Stack; import java.text.*; /** Model exported on Nov 10 2012, 19:51 by COMSOL 4.1.0.88. */ public class full_tpc_vw { public static void main(String[] args) { int deformcath=1; int force_loop=0; double force = 0.0;//[N] double forceStop =1; double forceStep =0.1; int degree_loop=0; double degree =-0.4; double DegStop =-0.1; double DegStep =0.1; int Els_loop=0; double ElsStart=-200; double ElsEnd=-400; double ElsStep=-10; double dLs=4.7; double dLsStart=4.7; double dLsStop=5.; double dLsStep=0.5; int shorts_loop=0; int shortci=4; //4 in reality int shortco=3; //3 in reality int other=1; double Els=-341; double Ed=-312.9; Integer nofStr=10;//485; double strShifti=0; double strShifto=0; String name; if (shorts_loop==1) { name="86ar85_newShorts"; // run(Ed,Els,4,3,name,dLs,nofStr,-3458.6,-3528.6,-25940,strShifti,strShifto,1,0,-0.1); // run(Ed,Els,3,3,name,dLs,nofStr,-3458.6,-3528.6,-25940,strShifti,strShifto,1,0,-0.1); // run(Ed,Els,3,2,name,dLs,nofStr,-3458.6,-3528.6,-25940,strShifti,strShifto,1,0,-0.1); run(Ed,Els,2,2,name,dLs,nofStr,-3458.6,-3528.6,-25940,strShifti,strShifto,1,0,-0.1); //run(Ed,Els,2,1,name,dLs,nofStr,-3458.6,-3528.6,-25940,strShifti,strShifto,1,0,-0.1); } Els=-341; if (degree_loop==1) { while(degree<=DegStop) { name="86ar85_rot"; run(Ed,Els,shortci,shortco,name,dLs,nofStr,-3458.6,-3528.6,-25940,strShifti,strShifto,1,force,degree); degree+=DegStep; } } degree=0; dLs=dLsStart; if (force_loop==1) { while(force<=forceStop) { while(dLs<=dLsStop) { name="86ar85_dLs_force"; run(Ed,Els,shortci,shortco,name,dLs,nofStr,-3458.6,-3528.6,-25940,strShifti,strShifto,deformcath,force,degree); dLs+=dLsStep; } force+=forceStep; dLs=dLsStart; } } if (Els_loop==1) { force=0; //Els=ElsStart; dLs=dLsStart; while(dLs<=dLsStop) { //while(Els>=ElsEnd) // { name="86ar85_dlsLoop"; run(Ed,Els,shortci,shortco,name,dLs,nofStr,-3458.6,-3528.6,-25940,strShifti,strShifto,deformcath,force,0); // Drift=86%, GEM=85% //Els+=ElsStep; // } dLs+=dLsStep; //Els=ElsStart; } } if(other==1) { name="86ar85_"; String name2=""; Els=-341; dLs=4.7; Ed=-312.89; //run(Ed,Els,shortci,shortco,name,dLs,nofStr,-3458.6,-3528.6,-25940,strShifti,strShifto,deformcath,force, degree); //run(Ed,Els,shortci,shortco,name,dLs,nofStr,-3458.6,-3528.6,-23346,strShifti,strShifto,deformcath,force); //NUR KRUEMMUNG //shortci=0; //shortco=0; //run(Ed,Els,shortci,shortco,name,dLs,nofStr,0,0,0,0,0,deformcath,force); //Perf POT-Without DISTORTIONS shortci=0; shortco=0; dLs=4.7; deformcath=0; force=0; degree=0; name2=name+"noDistortions"; //run(Ed,Els,shortci,shortco,name2,dLs,nofStr,0,0,0,0,0,deformcath,force,degree); //Perf POT-ShortCuts shortci=4; shortco=3; dLs=4.7; deformcath=0; force=0; degree=0; name2=name+"onlyShorts"; //run(Ed,Els,shortci,shortco,name2,dLs,nofStr,0,0,0,strShifti,strShifto,deformcath,force,degree); //REAL POT-last strip shortci=0; shortco=0; dLs=4.7; deformcath=0; force=0; degree = 0; name2=name+"realPot"; //run(Ed,Els,shortci,shortco,name2,dLs,nofStr,-3458.6,-3528.6,-25940,strShifti,strShifto,deformcath,force,degree); //Perf POT-Kruemmung shortci=0; shortco=0; dLs=4.7; deformcath=1; force = 0.3; degree = 0; name2=name+"onlyBending"; //run(Ed,Els,shortci,shortco,name2,dLs,nofStr,0,0,0,strShifti,strShifto,deformcath,force,degree); //Perf POT-Rotation shortci=0; shortco=0; dLs=4.7; deformcath=0; force=0; degree = -0.05; name2=name+"onlyRotation"; //run(Ed,Els,shortci,shortco,name2,dLs,nofStr,0,0,0,strShifti,strShifto,deformcath,force,degree); //REAL POT + shorts shortci=4; shortco=3; dLs=4.7; deformcath=0; force=0; degree = 0; name2=name+"realPot2row"; run(Ed,Els,shortci,shortco,name2,dLs,nofStr,-3458.6,-3528.6,-25940,strShifti,strShifto,deformcath,force,degree); System.out.println("****************SINGLE*********************"); } } public static Model run(double E1, double E2, Integer _shorti, Integer _shorto, String addon, double dLsG1, Integer nofStrips, double V1, double V2, double V3, double shi, double sho, int deformcath, double force, double degree) { // Integer nofStrips=10;//479; //Double dLsG1=0.47; String fieldf; //Settings Deformcath double step=0.1;//[mm] double length=105.0;//[mm] int corr=1050; double high=1.0;//[mm] double width=100.0;//[mm] double AreaMoment=high*Math.pow(width,3)*1/12 ; double Emod=36.0;//[MPa] Vector rValues = new Vector(); Vector zValues = new Vector(); Double zCathode=0.25+0.001+dLsG1+(nofStrips*1.5); Double zCathodedef=0.25+0.001+dLsG1+(nofStrips*1.5)+1; Integer stud=1; int dbgplots=0; int replace_file=0; Integer grid=1; double Edrift=E1; double Els=E2; double Vd=Edrift*(nofStrips*0.15); if (V3!=0) Vd=V3; //3.5 mm ls gem distance to strips double Vls=Els*(dLsG1/10.); if (V2!=0) Vls=V2; double Vgem=0; System.out.println("*******************************************"); System.out.println("now doing: Els="+Double.toString(Els)); System.out.println("Ed="+Double.toString(Edrift)); System.out.println("dLs="+Double.toString(dLsG1)); System.out.println("Inner/Outer Shorts:"+Integer.toString(_shorti)+"/"+Integer.toString(_shorto)); System.out.println("Inner/Outer Shift:"+Double.toString(shi)+"/"+Double.toString(sho)); System.out.println("NUmber of Strips="+Integer.toString(nofStrips)); System.out.println("Force"+Double.toString(force)); System.out.println("*******************************************"); if (V1!=0) { Vgem=V1; Edrift=(Vd-Vgem)/(nofStrips*0.15+dLsG1/10.); Els=(Vls-Vgem)/(dLsG1/10.); System.out.println("************CHANGED FIELDS*****************"); System.out.println("Els="+Double.toString(Els)); System.out.println("Ed="+Double.toString(Edrift)); System.out.println("*******************************************"); } Integer shortsi=_shorti; Integer shortso=_shorto; Integer midshort=1; double Vstepi=0; double Vstepo=0; if (shortsi>0) Vstepi=(Vd-Vls)/((double)nofStrips-((double)shortsi)); else Vstepi=(Vd-Vls)/((double)nofStrips-0.5); if (shortso>0) Vstepo=(Vd-Vls)/((double)nofStrips-((double)shortso)); else Vstepo=(Vd-Vls)/((double)nofStrips-0.5); //System.out.println(((double)nofStrips-((double)shorts/2.))); // int srow[][]=new int[][]{{1944,1,2428},{3890,1,4374},{4375,3,5827},{6319,3,7771}}; System.out.println("Vstepi:"+Double.toString(Vstepi)); System.out.println("Vstepo:"+Double.toString(Vstepo)); int srow[][]=new int[][]{{1944,1,2428}, {3890,1,4374}, {4375,3,5827}, {6319,3,7771}}; srow[0][0]=4*nofStrips+4; srow[0][1]=1; srow[0][2]=srow[0][0]+nofStrips-1; srow[1][0]=srow[0][2]+3*(nofStrips-1)+4; srow[1][1]=1; srow[1][2]=srow[1][0]+nofStrips-1; if (deformcath==1) { System.out.println("big offset"); srow[2][0]=srow[1][2]+1050+11; } else { System.out.println("no offset"); srow[2][0]=srow[1][2]+11; } srow[2][1]=3; srow[2][2]=srow[2][0]+3*(nofStrips-1); srow[3][0]=srow[2][2]+nofStrips+3; srow[3][1]=3; srow[3][2]=srow[3][0]+3*(nofStrips-1); int srow2[][]=new int[][]{{1944,1,2428}, {3890,1,4374}, {4375,3,5827}, {6319,3,7771}}; srow2[0][0]=3; srow2[0][1]=4; srow2[0][2]=srow2[0][0]+4*(nofStrips-1); srow2[1][0]=srow2[0][2]+1*(nofStrips-1)+6; srow2[1][1]=3; srow2[1][2]=srow2[1][0]+3*(nofStrips-1); if (deformcath==1) { System.out.println("big offset"); srow2[2][0]=srow2[1][2]+1050+13+4*nofStrips; System.out.println("*******"+Double.toString(srow2[2][0])); } else { System.out.println("no offset"); srow2[2][0]=srow2[1][2]+13+4*nofStrips; } srow2[2][1]=1; srow2[2][2]=srow2[2][0]+(nofStrips-1); srow2[3][0]=srow2[2][2]+3*nofStrips+2; srow2[3][1]=2; srow2[3][2]=srow2[3][0]+2*(nofStrips-1); int ngems; int[] ndriftDef=new int[1050]; int value; int stop; int stop2; if (degree != 0.){ value = srow[1][2]+4; stop = srow[1][2]+4; ngems=srow[1][2]+2; } else{ value = srow[1][2]+5; stop = srow[1][2]+5; ngems=srow[1][2]+3; } for (int i= 0; i < 1050; i++) { ndriftDef[i]=value; if (value == stop){ if (degree != 0.){ value+=5; } else{ value+=2; } } if ((degree!=0.) && (value == srow[1][2]+528)){ value+=2; } value+=1; } int ndrift=srow[1][2]+5; Model model = ModelUtil.create("Model"); // model.modelPath("E:/last_strip_studies"); String CathodeBending = "(Bforce*Clength^3)/(6*Emod*AreaMoment)*( (( x -CmaxR)/Clength)^3-3*(( x -CmaxR)/Clength)^2)+Cz"; model.param().set("Els" , Double.toString(Els) +" [V/cm]"); model.param().set("Edrift" , Double.toString(Edrift) +" [V/cm]"); model.param().set("dLsG1" , Double.toString(dLsG1) +" [mm]"); model.param().set("Vls" , Double.toString(Vls) +" [V]"); model.param().set("Vd" , Double.toString(Vd) +" [V]"); model.param().set("Vg" , Double.toString(Vgem) +" [V]"); model.param().set("shortsi", Integer.toString(shortsi)); model.param().set("shortso", Integer.toString(shortso)); model.param().set("Vstepi","(Vd-Vls) / (nofStrips-shortsi - 0.5*(shortsi==0) + 0.5*(shortsi>0) )"); model.param().set("Vstepo","(Vd-Vls) / (nofStrips-shortso - 0.5*(shortso==0) + 0.5*(shortso>0) )"); //substract 1 from nofstrips for short in the middle model.param().set("Bforce", Double.toString(force)+" [N]"); model.param().set("Emod", Double.toString(Emod)+" [MPa]"); model.param().set("AreaMoment",Double.toString(AreaMoment)+" [mm^4]"); model.param().set("nofStrips",Integer.toString(nofStrips)); model.param().set("Cz","0.25[mm]+0.001[mm]+dLsG1+(nofStrips*1.5[mm])"); model.param().set("Clength", "105[mm]"); model.param().set("CmaxR", "155[mm]"); model.param().set("CminZ", CathodeBending.replace(" x "," 50[mm]")); model.param().set("shi",Double.toString(shi)); model.param().set("sho",Double.toString(sho)); model.param().set("Anode_rot",Double.toString(degree)); model.modelNode().create("mod1"); model.func().create("an1", "Analytic"); model.func("an1") .set("expr", CathodeBending); model.func("an1").set("argunit", "m"); model.func("an1").set("plotargs", new String[][]{{"x", "50[mm]", "155[mm]"}}); System.out.println("starting Geometry"); model.geom().create("geom1", 2); model.geom("geom1").axisymmetric(true); model.geom("geom1").lengthUnit("mm"); model.geom("geom1").feature().create("r1", "Rectangle"); //gem if (deformcath==1) { model.geom("geom1").feature().create("Cathode_p1", "BezierPolygon");//deform cathode } else { model.geom("geom1").feature().create("Cathode", "Rectangle"); //cathode } model.geom("geom1").feature().create("r3", "Rectangle"); //volume //gem model.geom("geom1").feature("r1").set("size", new String[]{"105", "1-1e-3"}); double theta = Math.toRadians(degree); double offset=105./2*Math.tan(theta); double pos=-1*Math.abs(offset)-0.5; model.geom("geom1").feature("r1").set("pos", new String[]{"102.5", Double.toString(pos)}); model.geom("geom1").feature("r1").set("base", "center"); model.geom("geom1").feature("r1").set("rot", "Anode_rot"); //cathode double xminB=50; double xmaxB=155; double yminB; double ymaxB; if (deformcath==1) //calculate the values of the bending curve { String[][] CathodePoints=new String[2][4]; CathodePoints[0][0]="50"; CathodePoints[1][0]=CathodeBending.replace(" x "," 50[mm] "); CathodePoints[0][1]="50"; CathodePoints[1][1]="Cz+1[mm]"; CathodePoints[0][2]="155"; CathodePoints[1][2]="Cz+1[mm]"; CathodePoints[0][3]="155"; CathodePoints[1][3]=CathodeBending.replace(" x "," 155[mm] "); model.geom("geom1").feature("Cathode_p1") .set("p",CathodePoints); model.geom("geom1").feature("Cathode_p1") .set("w", new String[]{"1", "1", "1", "1", "1", "1"}); model.geom("geom1").feature("Cathode_p1").set("type", "open"); model.geom("geom1").feature("Cathode_p1") .set("degree", new String[]{"1", "1", "1"}); model.geom("geom1").feature().create("Cathode_p2", "ParametricCurve"); model.geom("geom1").feature("Cathode_p2").set("parmin", "50"); model.geom("geom1").feature("Cathode_p2").set("parmax", "155"); model.geom("geom1").feature("Cathode_p2").set("pos", new String[]{"0", "0"}); model.geom("geom1").feature("Cathode_p2") .set("coord", new String[]{"s", CathodeBending.replace(" x "," s ")}); model.geom("geom1").feature().create("Cathode", "ConvertToSolid"); model.geom("geom1").feature("Cathode").selection("input") .set(new String[]{"Cathode_p1", "Cathode_p2"}); ymaxB=zCathode; model.param().set("shi","-(Cz-CminZ)"); shi=(force*Math.pow(length,3))/(6*Emod*AreaMoment) * (Math.pow((50)/length,3)-3*(Math.pow((50)/length,2)));//move the inner strips } else { model.geom("geom1").feature("Cathode").set("pos", new String[]{"50", Double.toString(zCathode)}); model.geom("geom1").feature("Cathode").set("size", new String[]{"105", "1"}); yminB=zCathode-0.1; ymaxB=zCathode+0.1; } String fieldf_old="full_field_"+Double.toString(Els)+"_"+Double.toString(Edrift)+"_"+Integer.toString(_shorti)+"s"+Integer.toString(_shorto)+"_"+Double.toString(dLsG1)+"_"+Double.toString(shi)+"sh"+Double.toString(sho)+"_"+Double.toString(force)+"_"+Double.toString(degree)+"_"+addon; fieldf=String.format("full_field_%.2f_%.2f_%ds%d_%.3f_%.3fsh%.3f_%.4f_%.2f_%s",Els,Edrift,_shorti,_shorto,dLsG1,shi,sho,force,degree,addon); String outpath="/home/mberger/fopiroot/fopiroot_dev/vwalbre_COMSOL/Data/shortsTest/"; File runfile=new File(outpath+"/"+fieldf+".run"); if (replace_file==0) { System.out.println("Checking Fieldfile: "+outpath+fieldf+".txt"); if ( new File(outpath+"/"+fieldf+".txt").isFile() ) { System.out.println("Field already calculated. skipping"); return model; } if ( new File(outpath+"/"+fieldf_old+".txt").isFile() ) { System.out.println("Field already calculated. Skipping"); return model; } if (new File(outpath+"/"+fieldf+".run").isFile()) { System.out.println("Field is calculated at the moment"); return model; } try { runfile.createNewFile(); } catch (IOException e) { System.err.println("Error opening lockfile" + e.getMessage()); return model; } } //volume Double zVolume=zCathode+2.; model.geom("geom1").feature("r3").set("pos", new String[]{"50-25e-3-2e-3-3e-3 - 1e-3", "-1"}); model.geom("geom1").feature("r3").set("size", new String[]{"105+25e-3+2e-3+2e-3+25e-3+6e-3 + 2e-3","Cz+2[mm]"}); //strips Double zS1=dLsG1+0.75; model.geom("geom1").feature().create("r4", "Rectangle");//outer striprows model.geom("geom1").feature().create("r5", "Rectangle");//inner striprows model.geom("geom1").feature("r4").set("pos", new String[]{"50 - 3e-3", "dLsG1"}); model.geom("geom1").feature("r4").set("size", new String[]{"2e-3", "1"}); model.geom("geom1").feature("r5").set("pos", new String[]{"50 - 25e-3 - 2e-3 - 3e-3", "dLsG1+0.75"}); model.geom("geom1").feature("r5").set("size", new String[]{"2e-3", "1"}); model.geom("geom1").feature().create("arr1", "Array"); model.geom("geom1").feature().create("arr2", "Array"); model.geom("geom1").feature("arr1").set("size", new String[]{"1", "nofStrips"}); model.geom("geom1").feature("arr1").set("displ", new String[]{"0", "1.5"}); model.geom("geom1").feature("arr1").selection("input").set(new String[]{"r4"}); model.geom("geom1").feature("arr2").set("size", new String[]{"1", "nofStrips"}); model.geom("geom1").feature("arr2").set("displ", new String[]{"0", "1.5"}); model.geom("geom1").feature("arr2").selection("input").set(new String[]{"r5"}); model.geom("geom1").feature().create("strip_insulator","Rectangle"); model.geom("geom1").feature("strip_insulator").set("pos", new String[]{"50 - 25e-3 - 2e-3 - 1e-3","dLsG1"}); model.geom("geom1").feature("strip_insulator").set("size",new String[]{"25e-3","Cz+1[mm]-dLsG1-1e-3"}); model.geom("geom1").feature().create("mir1", "Mirror"); model.geom("geom1").feature("mir1").set("keep", true); model.geom("geom1").feature("mir1").set("pos", new String[]{"102.5", "0"}); model.geom("geom1").feature("mir1").selection("input").set(new String[]{"arr1","arr2","strip_insulator"}); model.geom("geom1").feature().create("mov1","Move"); model.geom("geom1").feature("mov1").selection("input").set(new String[]{"mir1"}); model.geom("geom1").feature("mov1").set("disply","sho"); model.geom("geom1").feature().create("mov2","Move"); model.geom("geom1").feature("mov2").selection("input").set(new String[]{"arr1","arr2","strip_insulator"}); model.geom("geom1").feature("mov2").set("disply","shi"); double stamp=System.currentTimeMillis(); model.geom("geom1").run(); System.out.println("Run Geometry needed: "+Double.toString((System.currentTimeMillis()-stamp)/1000)+" s"); int scounter=0; double xmin=0; double xmax=0; double ymin=0; double ymax=0; String shift=""; for (int row=0;row<4;row++) { System.out.println("adding selections to row: "+Integer.toString(row)); scounter=1; ymin=-1e-3; ymax=1+1e-3; if (row==0 | row==1) { //2 + first row + kapton scounter=2+nofStrips+1; //1e-3 is box offset to make sure other partis are inside xmin=50-3e-3 -1e-3; xmax=50-1e-3 +1e-3; //ymin+=shi; //ymax+=shi; shift="shi"; if (row==0) { //starts at 2 (1=air) scounter=2; //kapton thickness, other striprow thicknes + box offset xmin+=-25e-3 - 2e-3 - 1e-3; xmax+=-25e-3 + 1e-3; ymin+=0.75; ymax+=0.75; } } if (row==2 | row==3) { //2 + first row + kapton + second row + anode + cathode scounter=2 + nofStrips + 1 + nofStrips + 1 + 1; xmin=155; xmax=155+3e-3 +1e-3; //ymin+=sho; //ymax+=sho; shift="sho"; if(row==3) { //2 + first row + kapton + second row + anode + cathode + third row + kapton scounter=2 + nofStrips + 1 + nofStrips + 1 + 1 + nofStrips + 1; xmin+=25e-3 + 2e-3; xmax+=25e-3 + 2e-3; ymin+=0.75; ymax+=0.75; } } for (int st=0;st<=nofStrips-1;st++) { System.out.print("At strip "+Integer.toString(st)+" of "+Integer.toString(nofStrips-1)+"\r"); if (st>0) { ymin+=1.5; ymax+=1.5; } String sname="r" +Integer.toString(row)+"s"+Integer.toString(st); String selname="sel_"+sname; model.selection().create(selname,"Box"); model.selection(selname).name(selname); model.selection(selname).set("entitydim", "1"); model.selection(selname).set("inputent", "all"); model.selection(selname).set("condition", "inside"); model.selection(selname).set("groupcontang", "off"); model.selection(selname).set("xmin", Double.toString(xmin)); model.selection(selname).set("xmax", Double.toString(xmax)); model.selection(selname).set("ymin", Double.toString(ymin)+"+"+shift+"+dLsG1"); model.selection(selname).set("ymax", Double.toString(ymax)+"+"+shift+"+dLsG1"); //model.geom("geom1").run(selname); scounter++; } System.out.println(""); } //selection Anode String selnameAnod="sel_Anod"; double xminA=102.4; double xmaxA=102.6; double yminA=-0.1+offset; double ymaxA=0.1+offset; model.selection().create(selnameAnod,"Box"); model.selection(selnameAnod).name(selnameAnod); model.selection(selnameAnod).set("entitydim", "1"); model.selection(selnameAnod).set("inputent", "all"); model.selection(selnameAnod).set("condition", "intersects"); model.selection(selnameAnod).set("groupcontang", "off"); model.selection(selnameAnod).set("xmin", Double.toString(xminA)); model.selection(selnameAnod).set("xmax", Double.toString(xmaxA)); model.selection(selnameAnod).set("ymin", Double.toString(yminA)); model.selection(selnameAnod).set("ymax", Double.toString(ymaxA)); //selection bended Cathode String selnameBend="sel_Bend"; model.selection().create(selnameBend,"Box"); model.selection(selnameBend).name(selnameBend); model.selection(selnameBend).set("entitydim", "1"); model.selection(selnameBend).set("inputent", "all"); model.selection(selnameBend).set("condition", "intersects"); model.selection(selnameBend).set("groupcontang", "off"); model.selection(selnameBend).set("xmin", Double.toString(xminB)); model.selection(selnameBend).set("xmax", Double.toString(xmaxB)); model.selection(selnameBend).set("ymin", "CminZ-0.1[mm]"); model.selection(selnameBend).set("ymax", "Cz+0.1[mm]"); String selnameInsu1="sel_insu1"; model.selection().create(selnameInsu1,"Box"); model.selection(selnameInsu1).name(selnameInsu1); model.selection(selnameInsu1).set("entitydim","2"); model.selection(selnameInsu1).set("inputent","all"); model.selection(selnameInsu1).set("condition","intersects"); model.selection(selnameInsu1).set("groupcontang","off"); model.selection(selnameInsu1).set("xmin","49.98"); model.selection(selnameInsu1).set("xmax","49.99"); model.selection(selnameInsu1).set("ymin","CminZ"); model.selection(selnameInsu1).set("ymax","CminZ+0.1[mm]"); String selnameInsu2="sel_insu2"; model.selection().create(selnameInsu2,"Box"); model.selection(selnameInsu2).name(selnameInsu2); model.selection(selnameInsu2).set("entitydim","2"); model.selection(selnameInsu2).set("inputent","all"); model.selection(selnameInsu2).set("condition","intersects"); model.selection(selnameInsu2).set("groupcontang","off"); model.selection(selnameInsu2).set("xmin","155.01"); model.selection(selnameInsu2).set("xmax","155.02"); model.selection(selnameInsu2).set("ymin","CminZ"); model.selection(selnameInsu2).set("ymax","CminZ+0.1[mm]"); String selnameInsu="sel_Insu"; model.selection().create(selnameInsu, "Union"); model.selection(selnameInsu).set("input", new String[]{selnameInsu1, selnameInsu2}); System.out.println("Run Geometry and Selections needed: "+Double.toString((System.currentTimeMillis()-stamp)/1000)+" s"); System.out.println("adding materials"); model.material().create("mat1"); model.material("mat1").name("Copper"); model.material("mat1").set("family", "copper"); model.material("mat1").propertyGroup("def").set("relpermeability", "1"); model.material("mat1").propertyGroup("def") .set("electricconductivity", "5.998e7[S/m]"); model.material("mat1").propertyGroup("def") .set("thermalexpansioncoefficient", "17e-6[1/K]"); model.material("mat1").propertyGroup("def") .set("heatcapacity", "385[J/(kg*K)]"); model.material("mat1").propertyGroup("def").set("relpermittivity", "1"); model.material("mat1").propertyGroup("def") .set("density", "8700[kg/m^3]"); model.material("mat1").propertyGroup("def") .set("thermalconductivity", "400[W/(m*K)]"); model.material("mat1").propertyGroup() .create("Enu", "Elastizit\u00e4tsmodul und Poissonzahl"); model.material("mat1").propertyGroup("Enu").set("poissonsratio", "0.35"); model.material("mat1").propertyGroup("Enu") .set("youngsmodulus", "110e9[Pa]"); model.material("mat1").propertyGroup() .create("linzRes", "Linearisierter spezifischer Widerstand"); model.material("mat1").propertyGroup("linzRes") .set("alpha", "0.0039[1/K]"); model.material("mat1").propertyGroup("linzRes") .set("rho0", "1.72e-8[ohm*m]"); model.material("mat1").propertyGroup("linzRes").set("Tref", "298[K]"); model.material("mat1").set("family", "copper"); model.material().create("mat2"); model.material("mat2").name("Air"); model.material("mat2").set("family", "air"); model.material("mat2").propertyGroup("def").set("relpermeability", "1"); model.material("mat2").propertyGroup("def").set("relpermittivity", "1"); model.material("mat2").propertyGroup("def") .set("dynamicviscosity", "eta(T[1/K])[Pa*s]"); model.material("mat2").propertyGroup("def") .set("ratioofspecificheat", "1.4"); model.material("mat2").propertyGroup("def") .set("electricconductivity", "0[S/m]"); model.material("mat2").propertyGroup("def") .set("heatcapacity", "Cp(T[1/K])[J/(kg*K)]"); model.material("mat2").propertyGroup("def") .set("density", "rho(pA[1/Pa],T[1/K])[kg/m^3]"); model.material("mat2").propertyGroup("def") .set("thermalconductivity", "k(T[1/K])[W/(m*K)]"); model.material("mat2").propertyGroup("def") .set("soundspeed", "cs(T[1/K])[m/s]"); model.material("mat2").propertyGroup("def").func() .create("eta", "Piecewise"); model.material("mat2").propertyGroup("def").func("eta") .set("funcname", "eta"); model.material("mat2").propertyGroup("def").func("eta").set("arg", "T"); model.material("mat2").propertyGroup("def").func("eta") .set("extrap", "constant"); model.material("mat2").propertyGroup("def").func("eta") .set("pieces", new String[][]{{"200.0", "1600.0", "-8.38278E-7+8.35717342E-8*T^1-7.69429583E-11*T^2+4.6437266E-14*T^3-1.06585607E-17*T^4"}}); model.material("mat2").propertyGroup("def").func() .create("Cp", "Piecewise"); model.material("mat2").propertyGroup("def").func("Cp") .set("funcname", "Cp"); model.material("mat2").propertyGroup("def").func("Cp").set("arg", "T"); model.material("mat2").propertyGroup("def").func("Cp") .set("extrap", "constant"); model.material("mat2").propertyGroup("def").func("Cp") .set("pieces", new String[][]{{"200.0", "1600.0", "1047.63657-0.372589265*T^1+9.45304214E-4*T^2-6.02409443E-7*T^3+1.2858961E-10*T^4"}}); model.material("mat2").propertyGroup("def").func() .create("rho", "Analytic"); model.material("mat2").propertyGroup("def").func("rho") .set("funcname", "rho"); model.material("mat2").propertyGroup("def").func("rho") .set("args", new String[]{"pA", "T"}); model.material("mat2").propertyGroup("def").func("rho") .set("expr", "pA*0.02897/8.314/T"); model.material("mat2").propertyGroup("def").func("rho") .set("dermethod", "manual"); model.material("mat2").propertyGroup("def").func("rho") .set("argders", new String[][]{{"pA", "d(pA*0.02897/8.314/T,pA)"}, {"T", "d(pA*0.02897/8.314/T,T)"}}); model.material("mat2").propertyGroup("def").func() .create("k", "Piecewise"); model.material("mat2").propertyGroup("def").func("k") .set("funcname", "k"); model.material("mat2").propertyGroup("def").func("k").set("arg", "T"); model.material("mat2").propertyGroup("def").func("k") .set("extrap", "constant"); model.material("mat2").propertyGroup("def").func("k") .set("pieces", new String[][]{{"200.0", "1600.0", "-0.00227583562+1.15480022E-4*T^1-7.90252856E-8*T^2+4.11702505E-11*T^3-7.43864331E-15*T^4"}}); model.material("mat2").propertyGroup("def").func() .create("cs", "Analytic"); model.material("mat2").propertyGroup("def").func("cs") .set("funcname", "cs"); model.material("mat2").propertyGroup("def").func("cs") .set("args", new String[]{"T"}); model.material("mat2").propertyGroup("def").func("cs") .set("expr", "sqrt(1.4*287*T)"); model.material("mat2").propertyGroup("def").func("cs") .set("dermethod", "manual"); model.material("mat2").propertyGroup("def").func("cs") .set("argders", new String[][]{{"T", "d(sqrt(1.4*287*T),T)"}}); model.material("mat2").propertyGroup("def").addInput("temperature"); model.material("mat2").propertyGroup("def").addInput("pressure"); model.material("mat2").set("family", "air"); model.material().create("mat3"); model.material("mat3").propertyGroup("def").func() .create("k", "Piecewise"); model.material("mat3").propertyGroup("def").func() .create("C", "Piecewise"); model.material("mat3").propertyGroup("def").func() .create("rho", "Piecewise"); model.material("mat3").name("Polyimide tape (Kapton HN) [solid]"); model.material("mat3").propertyGroup("def").func("k") .set("pieces", new String[][]{{"5.0", "140.0", "-0.001372384+0.005601653*T^1+2.082966E-6*T^2-5.05445E-9*T^3"}, {"140.0", "300.0", "-0.007707532+0.005769136*T^1+5.622796E-7*T^2-4.329984E-10*T^3"}}); model.material("mat3").propertyGroup("def").func("k").set("arg", "T"); model.material("mat3").propertyGroup("def").func("C") .set("pieces", new String[][]{{"4.0", "30.0", "2.809666-1.394349*T^1+0.2106639*T^2+0.004752016*T^3-3.279998E-4*T^4+4.282249E-6*T^5"}, {"30.0", "300.0", "-86.86946+7.816917*T^1-0.03664788*T^2+9.9128E-5*T^3-1.08441E-7*T^4"}}); model.material("mat3").propertyGroup("def").func("C").set("arg", "T"); model.material("mat3").propertyGroup("def").func("rho") .set("pieces", new String[][]{{"293.0", "303.0", "1420.0"}}); model.material("mat3").propertyGroup("def").func("rho").set("arg", "T"); model.material("mat3").propertyGroup("def") .set("thermalconductivity", new String[]{"k(T[1/K])[W/(m*K)]", "0", "0", "0", "k(T[1/K])[W/(m*K)]", "0", "0", "0", "k(T[1/K])[W/(m*K)]"}); model.material("mat3").propertyGroup("def") .set("heatcapacity", "C(T[1/K])[J/(kg*K)]"); model.material("mat3").propertyGroup("def") .set("density", "rho(T[1/K])[kg/m^3]"); model.material("mat3").propertyGroup("def") .set("relpermittivity", new String[]{"3.83", "0", "0", "0", "3.83", "0", "0", "0", "3.83"}); model.material("mat3").propertyGroup("def").addInput("temperature"); model.material("mat1").selection().all(); model.material().move("mat2", 1); model.material("mat2").selection().set(new int[]{1}); model.material("mat3").selection().named(selnameInsu); stamp=System.currentTimeMillis(); System.out.println("adding physics"); model.physics().create("es", "Electrostatics", "geom1"); scounter=0; double pot=0; double Vstep; xmin=0; xmax=0; ymin=0; ymax=0; //set potentials of field strips stamp=System.currentTimeMillis(); for (int row=0;row<4;row++){ scounter=0; System.out.println("adding potential to row: "+Integer.toString(row)); int[] strip = new int[4]; strip[0]=srow[row][0]; strip[1]=srow2[row][0]; ymin=dLsG1-1e-3; ymax=dLsG1+1+1e-3; if (row==0 | row==1) { strip[2]=strip[1]+1; //1e-3 is box offset to make sure other partis are inside xmin=50-3e-3 -1e-3; xmax=50-1e-3 +1e-3; ymin+=shi; ymax+=shi; if (row==0) { //kapton thickness, other striprow thicknes + box offset xmin+=-25e-3-2e-3 -1e-3; xmax+=-25e-3 +1e-3; ymin+=0.75; ymax+=0.75; } } if (row==2 | row==3) { xmin=155; xmax=155+3e-3 +1e-3; ymin+=sho; ymax+=sho; strip[2]=strip[0]+1; if(row==3) { xmin+=25e-3+2e-3; xmax+=25e-3+2e-3; ymin+=0.75; ymax+=0.75; } } if (row==0) {strip[3]=strip[2]+2;} else {strip[3]=strip[2]+1;} for (int st=0;st<=nofStrips-1;st++) { System.out.print("At strip "+Integer.toString(st)+" of "+Integer.toString(nofStrips-1)+"\r"); if (st>0) { ymin+=1.5; ymax+=1.5; } String sname="r" +Integer.toString(row)+"s"+Integer.toString(st); String selname="sel_"+sname; model.physics("es").feature().create(sname, "ElectricPotential", 1); model.physics("es").feature(sname).selection().named(selname); model.physics("es").feature(sname).name(sname); String potS=""; String VstepS=""; if (row==0|row==1) { Vstep=Vstepi; VstepS="Vstepi"; } else { Vstep=Vstepo; VstepS="Vstepo"; } /*this is for creating a shortcut in the middle of outer fieldcage if (row==2 | row==3) { if(st==Math.ceil(nofStrips/2)) scounter--; } end shortcut */ if (row==0 | row==3) { pot=Vls+Vstep/2.+Vstep*scounter; potS="Vls+"+VstepS+"/2.+"+VstepS+"*"+Integer.toString(scounter); } else { pot=Vls+Vstep*scounter; potS="Vls+"+VstepS+"*"+Integer.toString(scounter); } /* if (pot<=Vd) { pot=Vd; potS="Vd"; } */ potS="("+potS+")*( ("+potS+")>Vd)+Vd*(("+potS+")<=Vd) "; //if (row==3) //potS="("+potS+")"+"-(midshort>0)*("+Integer.toString(scounter)+"==ceil(nofStrips/2.))*"+potS; model.physics("es").feature(sname).set("V0", potS); scounter++; strip[0]+=srow[row][1]; strip[1]+=srow2[row][1]; if (row==0 | row==1) {strip[2]=strip[1]+1;} if (row==2 | row==3) {strip[2]=strip[0]+1;} if (row==0) {strip[3]=strip[2]+2;} else {strip[3]=strip[2]+1;} } System.out.println(""); } System.out.println("Adding Physics needed: "+Double.toString((System.currentTimeMillis()-stamp)/1000)+" s"); //set potential of drift System.out.println("Adding drift potential"); model.physics("es").feature().create("Vdrift", "ElectricPotential", 1); model.physics("es").feature("Vdrift").selection().named(selnameBend); model.physics("es").feature("Vdrift").name("Vdrift"); model.physics("es").feature("Vdrift").set("V0", "Vd"); //set gem potential System.out.println("adding gem potential"); model.physics("es").feature().create("Vgem", "ElectricPotential", 1); model.physics("es").feature("Vgem").selection().named(selnameAnod); model.physics("es").feature("Vgem").name("Vgem"); model.physics("es").feature("Vgem").set("V0", "Vg"); System.out.println("adding mesh"); model.mesh().create("mesh1", "geom1"); model.mesh("mesh1").feature().create("ftri1", "FreeTri"); model.mesh("mesh1").feature("size").set("hauto", 4); //model.mesh("mesh1").feature("size").set("hauto", "9"); model.mesh("mesh1").feature("size").set("hmax", "100"); model.mesh("mesh1").feature("size").set("hmin", "15"); //model.mesh("mesh1").feature("size").set("hmax", "30"); //model.mesh("mesh1").feature("size").set("hmin", "0.1"); model.mesh("mesh1").feature("size").set("hcurve", "1"); model.mesh("mesh1").feature("size").set("hgrad", "1.2"); model.mesh("mesh1").feature("size").set("hnarrow", "0.05"); //model.mesh("mesh1").feature("size").set("hgrad", "2"); //model.mesh("mesh1").feature("size").set("hnarrow", "0.005"); model.mesh("mesh1").feature("ftri1").set("xscale", "10"); model.mesh("mesh1").feature("ftri1").set("yscale", "10"); System.out.println("adding study"); model.study().create("std1"); model.study("std1").feature().create("stat", "Stationary"); if (stud==1) { System.out.println("start meshing"); model.mesh("mesh1").run(); System.out.println("start study"); model.study("std1").run(); System.out.println("creating solution"); model.sol("sol1").study("std1"); model.sol("sol1").attach("std1"); System.out.println("Creating fieldmatrix"); if (grid==2) { // File file=new File("/nfs/hicran/project/panda/SIM/bergerm/"+fieldf+".txt"); File file=new File(outpath+fieldf+".txt"); try { // File file; // file=new File("/nfs/hicran/project/panda/SIM/bergerm/"+fieldf+".txt"); FileWriter writer=new FileWriter(file,true); // BufferedWriter writer = new BufferedWriter(fstream); Double x; Double y; model.result().dataset().create("cpt2", "CutPoint2D"); model.result().numerical().create("Er","EvalPoint"); model.result().numerical().create("Ez","EvalPoint"); model.result().numerical().create("V","EvalPoint"); for(x=50.;x<=155.;x++) { for(y=0.;y<=3.5+nofStrips*1.5;y++) { model.result().dataset("cpt2").set("pointy", Double.toString(x)); model.result().dataset("cpt2").set("pointx", Double.toString(y)); model.result().numerical("Er").set("data","cpt2"); model.result().numerical("Er").set("expr","es.Er"); model.result().numerical("Er").set("unit","V/cm"); model.result().numerical("Er").run(); model.result().numerical("Ez").set("data","cpt2"); model.result().numerical("Ez").set("expr","es.Ez"); model.result().numerical("Ez").set("unit","V/cm"); model.result().numerical("Ez").run(); model.result().numerical("V").set("data","cpt2"); model.result().numerical("V").set("expr","V"); model.result().numerical("V").set("unit","V"); model.result().numerical("V").run(); Double resultEr; Double resultEz; Double resultV; System.out.println(Arrays.deepToString(model.result().numerical("Er").getReal())); resultEr=model.result().numerical("Er").getReal()[0][0]; resultEz=model.result().numerical("Ez").getReal()[0][0]; resultV=model.result().numerical("V").getReal()[0][0]; writer.write(Double.toString(x)+" "); writer.write(Double.toString(y)+" "); writer.write(Double.toString(resultEr)+" "); writer.write(Double.toString(resultEz)+" "); writer.write(Double.toString(resultV)); writer.write(System.getProperty("line.separator")); writer.flush(); System.out.println(Double.toString(x)+" "+Double.toString(y)+" "+Double.toString(resultEr)+" "+Double.toString(resultEz)); } } writer.close();}catch(IOException e){e.printStackTrace();System.err.println("hhh");} } if (grid==1) { model.result().dataset().create("cpt1", "CutPoint2D"); model.result().dataset("cpt1").set("method", "grid"); model.result().dataset("cpt1").set("gridx", "range(50,0.5,155)"); model.result().dataset("cpt1").set("gridy", "range(0,0.5,dLsG1+nofStrips*1.5)"); model.result().dataset("cpt1").run(); System.out.println("adding result"); model.result().dataset("cpt1").run(); model.result().export().create("data1", "Data"); model.result().export("data1").set("data", "cpt1"); model.result().export("data1").setIndex("expr", "es.Er", 0); model.result().export("data1").setIndex("expr", "es.Ez", 1); model.result().export("data1").setIndex("expr", "V", 2); model.result().export("data1").setIndex("unit", "V/cm", 0); model.result().export("data1").setIndex("unit", "V/cm", 1); model.result().export("data1").setIndex("unit", "V", 2); model.result().export("data1") .set("filename", outpath+"/"+fieldf+".txt"); System.out.println("exporting result to "+outpath+"/"+fieldf+".txt"); model.result().export("data1").run(); } } if (dbgplots==1 && stud==1) { model.view().create("view4", "geom1"); model.view("view4").name("close to strips inner"); model.view("view4").axis().set("xmin", "48.10865783691406"); model.view("view4").axis().set("ymin", "435.55169677734375"); model.view("view4").axis().set("xmax", "54.41270065307617"); model.view("view4").axis().set("ymax", "438.97540283203125"); model.view().create("view5", "geom1"); model.view("view5").name("close to cathode corner"); model.view("view5").axis().set("xmin", "27.22735023498535"); model.view("view5").axis().set("ymin", "708.2424926757812"); model.view("view5").axis().set("xmax", "76.30726623535156"); model.view("view5").axis().set("ymax", "734.8976440429688"); System.out.println("creating cutlines"); model.result().dataset().create("cln1", "CutLine2D"); model.result().dataset().create("cln2", "CutLine2D"); model.result().dataset().create("cln4", "CutLine2D"); model.result().dataset("cln1").name("left"); model.result().dataset("cln1") .set("genpoints", new String[][]{{"50-12.5e-3", "0"}, {"50-12.5e-3", "1000"}}); model.result().dataset("cln1").set("genparadist", "range(0,-0.5,-20)"); model.result().dataset("cln1").set("genparaactive", "on"); model.result().dataset("cln2").name("right"); model.result().dataset("cln2") .set("genpoints", new String[][]{{"155+12.5e-3", "0"}, {"155+12.5e-3", "1000"}}); model.result().dataset("cln4").name("Last Strip"); model.result().dataset("cln4") .set("genpoints", new String[][]{{"49", "dLsG1+0.5"}, {"156", "dLsG1+0.5"}}); model.result().create("pg_pot", 2); model.result("pg_pot").set("data", "dset1"); model.result("pg_pot").feature().create("surf1", "Surface"); model.result("pg_pot").feature("surf1").set("expr", "V"); model.result("pg_pot").feature("surf1").set("descr", "Electric potential"); model.result("pg_pot").set("windowtitle", "Graphics"); model.result("pg_pot").feature().create("con1", "Contour"); model.result("pg_pot").feature("con1").set("levelmethod", "number"); model.result("pg_pot").feature("con1").set("number", "80"); model.result("pg_pot").feature("con1").set("colorlegend", "off"); model.result("pg_pot").set("windowtitle", "Graphics"); model.result("pg_pot").feature("con1").set("colorlegend", "off"); model.result("pg_pot").feature("con1").set("coloring", "uniform"); model.result("pg_pot").feature("con1").set("color", "black"); model.result("pg_pot").name("Potential"); model.result("pg_pot").run(); System.out.println("creating plotgroup2d Er"); model.result().create("pg_er", "PlotGroup2D"); model.result("pg_er").set("data", "dset1"); model.result("pg_er").feature().create("surf1", "Surface"); model.result("pg_er").feature("surf1").set("expr", "es.Er"); model.result("pg_er").feature("surf1").set("unit", "V/cm"); model.result("pg_er").feature("surf1").set("rangecoloractive", "on"); model.result("pg_er").feature("surf1").set("rangecolormin", "-20"); model.result("pg_er").feature("surf1").set("rangecolormax", "20"); model.result("pg_er").name("Radial Field"); model.result("pg_er").run(); System.out.println("creating plotgroup2d Ez"); model.result().create("pg_ez", "PlotGroup2D"); model.result("pg_ez").set("data", "dset1"); model.result("pg_ez").feature().create("surf1", "Surface"); model.result("pg_ez").feature("surf1").set("expr", "es.Ez"); model.result("pg_ez").feature("surf1").set("unit", "V/cm"); model.result("pg_ez").feature("surf1").set("rangecoloractive", "on"); model.result("pg_ez").feature("surf1").set("rangecolormin", "200"); model.result("pg_ez").feature("surf1").set("rangecolormax", "400"); model.result("pg_ez").name("Drift Field"); model.result("pg_ez").run(); System.out.println("creating plotgroup2d normE"); model.result().create("pg_e", "PlotGroup2D"); model.result("pg_e").set("data", "dset1"); model.result("pg_e").feature().create("surf1", "Surface"); model.result("pg_e").feature("surf1").set("expr", "es.normE"); model.result("pg_e").feature("surf1").set("unit", "V/cm"); model.result("pg_e").feature("surf1").set("rangecoloractive", "on"); model.result("pg_e").feature("surf1").set("rangecolormin", "200"); model.result("pg_e").feature("surf1").set("rangecolormax", "400"); model.result("pg_e").name("Abs Field"); model.result("pg_e").run(); System.out.println("creating plotgroup1d V"); model.result().create("pg4", "PlotGroup1D"); model.result("pg4").feature().create("lngr1", "LineGraph"); model.result("pg4").feature().create("lngr2", "LineGraph"); model.result("pg4").set("title", "Line Graph: Electric potential (V) Line Graph: Electric potential (V) "); model.result("pg4").set("xlabel", "Arc length"); model.result("pg4").set("ylabel", "Electric potential (V)"); model.result("pg4").set("titleactive", false); model.result("pg4").set("xlabelactive", false); model.result("pg4").set("ylabelactive", false); model.result("pg4").feature("lngr1").set("data", "cln1"); model.result("pg4").feature("lngr1").set("legend", true); model.result("pg4").feature("lngr2").set("data", "cln2"); model.result("pg4").feature("lngr2").set("legend", true); model.result("pg4").name("Potential along strips"); System.out.println("creating paper plots"); model.result().create("pg8", "PlotGroup1D"); model.result("pg8").feature().create("lngr1", "LineGraph"); model.result("pg8").feature().create("lngr2", "LineGraph"); model.result("pg8").name("Paper stuff"); model.result("pg8").set("xlabel", "Bogenl\u00e4nge"); model.result("pg8") .set("ylabel", "Elektrisches Feld, r-Komponente (V/m)"); model.result("pg8").set("ylabelactive", false); model.result("pg8").set("xlabelactive", false); model.result("pg8").feature("lngr1").name("Er"); model.result("pg8").feature("lngr1").set("data", "cln1"); model.result("pg8").feature("lngr1") .set("descr", "Elektrisches Feld, r-Komponente"); model.result("pg8").feature("lngr1").set("unit", "V/m"); model.result("pg8").feature("lngr1").set("legend", true); model.result("pg8").feature("lngr1").set("expr", "es.Er"); model.result("pg8").feature("lngr2").name("Drift diff"); model.result("pg8").feature("lngr2").set("data", "cln1"); model.result("pg8").feature("lngr2") .set("descr", "(es.Ez-309.6[V/m])/309.6[V/m]"); model.result("pg8").feature("lngr2").set("unit", "1"); model.result("pg8").feature("lngr2").set("legend", true); model.result("pg8").feature("lngr2") .set("expr", "(es.Ez-309.6[V/m])/309.6[V/m]"); model.result().create("pg9", "PlotGroup1D"); model.result("pg9").feature().create("lngr1", "LineGraph"); model.result("pg9").name("Er along last strip"); model.result("pg9").set("data", "cln4"); model.result("pg9").set("xlabel", "Arc length"); model.result("pg9").set("ylabel", "Electric field, r component (V/cm)"); model.result("pg9").set("ylabelactive", false); model.result("pg9").set("xlabelactive", false); model.result("pg9").feature("lngr1") .set("descr", "Electric field, r component"); model.result("pg9").feature("lngr1").set("unit", "V/cm"); model.result("pg9").feature("lngr1").set("resolution", "fine"); model.result("pg9").feature("lngr1").set("expr", "es.Er"); model.result().create("pg10", "PlotGroup1D"); model.result("pg10").feature().create("lngr1", "LineGraph"); model.result("pg10").name("Ez along last strip"); model.result("pg10").set("xlabel", "Arc length"); model.result("pg10").set("ylabel", "Electric field, z component (V/cm)"); model.result("pg10").set("ylabelactive", false); model.result("pg10").set("xlabelactive", false); model.result("pg10").feature("lngr1").set("data", "cln4"); model.result("pg10").feature("lngr1") .set("descr", "Electric field, z component"); model.result("pg10").feature("lngr1").set("unit", "V/cm"); model.result("pg10").feature("lngr1").set("expr", "es.Ez"); model.result().export().create("plot2", "Plot"); model.result().export("plot2").name("Erlines"); model.result().export("plot2") .set("filename", outpath+"/fieldlines_"+fieldf+"_Er_lines.txt"); model.result().export("plot2").set("plotgroup", "pg8"); model.result().export().create("plot3", "Plot"); model.result().export("plot3").name("Ez_diff"); model.result().export("plot3") .set("filename", outpath+"/fieldlines_"+fieldf+"_Ezdiff_lines.txt"); model.result().export("plot3").set("plotgroup", "pg8"); model.result().export("plot3").set("plot", "lngr2"); model.result().export("plot2").run(); model.result().export("plot3").run(); model.result().export().create("img1", "Image2D"); model.result().export().create("img2", "Image2D"); model.result().export().create("img3", "Image2D"); model.result().export().create("img4", "Image2D"); model.result().export().create("img5", "Image2D"); model.result().export().create("img6", "Image2D"); model.result().export("img1").set("resolution", "600"); model.result().export("img1").set("options", "on"); model.result().export("img1") .set("pngfilename", "/home/mberger/fopiroot/fopiroot_dev/tpc_field_COMSOL/exports/perfect_field/field_radial_strips.png"); model.result().export("img1").set("sizedesc", "102 x 68 mm"); model.result().export("img1").set("view", "view4"); model.result().export("img1").set("fontsize", "5"); model.result().export("img1").set("logo", false); model.result().export("img1").set("width", "2400"); model.result().export("img1").set("height", "1600"); model.result().export("img1").set("plotgroup", "pg_er"); model.result().export("img1").set("unit", "px"); model.result().export("img1").set("height", "1600"); model.result().export("img1").set("width", "2400"); model.result().export("img1").set("lockratio", "off"); model.result().export("img1").set("resolution", "600"); model.result().export("img1").set("size", "manual"); model.result().export("img1").set("antialias", "on"); model.result().export("img1").set("title", "on"); model.result().export("img1").set("legend", "on"); model.result().export("img1").set("logo", "off"); model.result().export("img1").set("options", "on"); model.result().export("img1").set("fontsize", "5"); model.result().export("img1").set("customcolor", new double[]{1, 1, 1}); model.result().export("img1").set("background", "color"); model.result().export("img1").set("qualitylevel", "92"); model.result().export("img1").set("qualityactive", "off"); model.result().export("img1").set("imagetype", "png"); model.result().export("img1").set("axes", "on"); model.result().export("img2").set("resolution", "600"); model.result().export("img2").set("options", "on"); model.result().export("img2") .set("pngfilename", "/home/mberger/fopiroot/fopiroot_dev/tpc_field_COMSOL/exports/perfect_field/field_z_strips.png"); model.result().export("img2").set("sizedesc", "102 x 68 mm"); model.result().export("img2").set("view", "view4"); model.result().export("img2").set("fontsize", "5"); model.result().export("img2").set("logo", false); model.result().export("img2").set("width", "2400"); model.result().export("img2").set("plotgroup", "pg_ez"); model.result().export("img2").set("height", "1600"); model.result().export("img2").set("unit", "px"); model.result().export("img2").set("height", "1600"); model.result().export("img2").set("width", "2400"); model.result().export("img2").set("lockratio", "off"); model.result().export("img2").set("resolution", "600"); model.result().export("img2").set("size", "manual"); model.result().export("img2").set("antialias", "on"); model.result().export("img2").set("title", "on"); model.result().export("img2").set("legend", "on"); model.result().export("img2").set("logo", "off"); model.result().export("img2").set("options", "on"); model.result().export("img2").set("fontsize", "5"); model.result().export("img2").set("customcolor", new double[]{1, 1, 1}); model.result().export("img2").set("background", "color"); model.result().export("img2").set("qualitylevel", "92"); model.result().export("img2").set("qualityactive", "off"); model.result().export("img2").set("imagetype", "png"); model.result().export("img2").set("axes", "on"); model.result().export("img3").set("resolution", "600"); model.result().export("img3").set("options", "on"); model.result().export("img3") .set("pngfilename", "/home/mberger/fopiroot/fopiroot_dev/tpc_field_COMSOL/exports/perfect_field/field_abs_strips.png"); model.result().export("img3").set("sizedesc", "102 x 68 mm"); model.result().export("img3").set("view", "view4"); model.result().export("img3").set("fontsize", "5"); model.result().export("img3").set("logo", false); model.result().export("img3").set("width", "2400"); model.result().export("img3").set("plotgroup", "pg_e"); model.result().export("img3").set("height", "1600"); model.result().export("img3").set("unit", "px"); model.result().export("img3").set("height", "1600"); model.result().export("img3").set("width", "2400"); model.result().export("img3").set("lockratio", "off"); model.result().export("img3").set("resolution", "600"); model.result().export("img3").set("size", "manual"); model.result().export("img3").set("antialias", "on"); model.result().export("img3").set("title", "on"); model.result().export("img3").set("legend", "on"); model.result().export("img3").set("logo", "off"); model.result().export("img3").set("options", "on"); model.result().export("img3").set("fontsize", "5"); model.result().export("img3").set("customcolor", new double[]{1, 1, 1}); model.result().export("img3").set("background", "color"); model.result().export("img3").set("qualitylevel", "92"); model.result().export("img3").set("qualityactive", "off"); model.result().export("img3").set("imagetype", "png"); model.result().export("img3").set("axes", "on"); model.result().export("img4").set("resolution", "600"); model.result().export("img4").set("options", "on"); model.result().export("img4") .set("pngfilename", "/home/mberger/fopiroot/fopiroot_dev/tpc_field_COMSOL/exports/perfect_field/field_radial_cathode.png"); model.result().export("img4").set("sizedesc", "102 x 68 mm"); model.result().export("img4").set("view", "view5"); model.result().export("img4").set("fontsize", "5"); model.result().export("img4").set("logo", false); model.result().export("img4").set("width", "2400"); model.result().export("img4").set("height", "1600"); model.result().export("img4").set("plotgroup", "pg_er"); model.result().export("img4").set("unit", "px"); model.result().export("img4").set("height", "1600"); model.result().export("img4").set("width", "2400"); model.result().export("img4").set("lockratio", "off"); model.result().export("img4").set("resolution", "600"); model.result().export("img4").set("size", "manual"); model.result().export("img4").set("antialias", "on"); model.result().export("img4").set("title", "on"); model.result().export("img4").set("legend", "on"); model.result().export("img4").set("logo", "off"); model.result().export("img4").set("options", "on"); model.result().export("img4").set("fontsize", "5"); model.result().export("img4").set("customcolor", new double[]{1, 1, 1}); model.result().export("img4").set("background", "color"); model.result().export("img4").set("qualitylevel", "92"); model.result().export("img4").set("qualityactive", "off"); model.result().export("img4").set("imagetype", "png"); model.result().export("img4").set("axes", "on"); model.result().export("img5").set("resolution", "600"); model.result().export("img5").set("options", "on"); model.result().export("img5") .set("pngfilename", "/home/mberger/fopiroot/fopiroot_dev/tpc_field_COMSOL/exports/perfect_field/field_z_cathode.png"); model.result().export("img5").set("sizedesc", "102 x 68 mm"); model.result().export("img5").set("view", "view5"); model.result().export("img5").set("fontsize", "5"); model.result().export("img5").set("logo", false); model.result().export("img5").set("width", "2400"); model.result().export("img5").set("plotgroup", "pg_ez"); model.result().export("img5").set("height", "1600"); model.result().export("img5").set("unit", "px"); model.result().export("img5").set("height", "1600"); model.result().export("img5").set("width", "2400"); model.result().export("img5").set("lockratio", "off"); model.result().export("img5").set("resolution", "600"); model.result().export("img5").set("size", "manual"); model.result().export("img5").set("antialias", "on"); model.result().export("img5").set("title", "on"); model.result().export("img5").set("legend", "on"); model.result().export("img5").set("logo", "off"); model.result().export("img5").set("options", "on"); model.result().export("img5").set("fontsize", "5"); model.result().export("img5").set("customcolor", new double[]{1, 1, 1}); model.result().export("img5").set("background", "color"); model.result().export("img5").set("qualitylevel", "92"); model.result().export("img5").set("qualityactive", "off"); model.result().export("img5").set("imagetype", "png"); model.result().export("img5").set("axes", "on"); model.result().export("img6").set("resolution", "600"); model.result().export("img6").set("options", "on"); model.result().export("img6") .set("pngfilename", "/home/mberger/fopiroot/fopiroot_dev/tpc_field_COMSOL/exports/perfect_field/field_abs_cathode.png"); model.result().export("img6").set("sizedesc", "102 x 68 mm"); model.result().export("img6").set("view", "view5"); model.result().export("img6").set("fontsize", "5"); model.result().export("img6").set("logo", false); model.result().export("img6").set("width", "2400"); model.result().export("img6").set("plotgroup", "pg_e"); model.result().export("img6").set("height", "1600"); model.result().export("img6").set("unit", "px"); model.result().export("img6").set("height", "1600"); model.result().export("img6").set("width", "2400"); model.result().export("img6").set("lockratio", "off"); model.result().export("img6").set("resolution", "600"); model.result().export("img6").set("size", "manual"); model.result().export("img6").set("antialias", "on"); model.result().export("img6").set("title", "on"); model.result().export("img6").set("legend", "on"); model.result().export("img6").set("logo", "off"); model.result().export("img6").set("options", "on"); model.result().export("img6").set("fontsize", "5"); model.result().export("img6").set("customcolor", new double[]{1, 1, 1}); model.result().export("img6").set("background", "color"); model.result().export("img6").set("qualitylevel", "92"); model.result().export("img6").set("qualityactive", "off"); model.result().export("img6").set("imagetype", "png"); model.result().export("img6").set("axes", "on"); } runfile.delete(); System.out.println("all done"); return model; } }