- **Main CFD Forum**
(*http://www.cfd-online.com/Forums/main/*)

- - **Automatic integration COMSOL**
(*http://www.cfd-online.com/Forums/main/109510-automatic-integration-comsol.html*)

Automatic integration COMSOLHello,
I have a COMSOL 3.5 3D simulation in which I would like to calculate the integral of a specific variable over just a portion of a boundary, not over the whole boundary. I know that I can do this by simply specifying the x and y coordinates that define the region I want to deal with as follows: f(x,y)*(x>A)*(x<B)*(y>C)*(y<D) My problem is that I want to divide this boundary in 100 portions and to calculate the integral of the function f(x,y) in all of them. Doing the same thing (only changing the coordinates) 100 times and for many different files seems really irksome to me, so I was wondering if there is a way to do this automatically. I had thought about writing the necessary commands in a *.m file and executing it, but I don't see how I can export the values of the integrals to a *.txt file or similar. Does anybody have a clue? |

Well, I could figure it out. With the command xlswrite('filename.xls', data), I can get a xls file with the data resulting from the integration. That would be:
vJ=postint(fem,'f(x,y)*(x>J)*(y>J)', ... 'unit','units', ... 'recover','off', ... 'dl',[Boundaries] xlswrite('filename.xls', vJ) My problem now is that J takes 100 different values, so I would like to define a counter variable in order to use something similar to a "for...next" instruction. Anybody knows how to do it?? |

All times are GMT -4. The time now is 21:24. |