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.

Export fieldmap in a different coordinate system

Please login with a confirmed email address before reporting spam

Hello,
I am wondering if it is possible (easily!) to export a simulated fieldmap in a coordinate system which is different from the global coordinate system (origin moved, and axes rotated). I would like to do this because the geometry is best modelled in a certain coordinate system, but another application needs the fieldmap in another system.
Thank you
Daniel

2 Replies Last Post 9 feb 2015, 08:16 GMT-5
Sven Friedel COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 3 feb 2015, 03:11 GMT-5
Hi Daniel,

1) you can define under definitions a coordinate system of your choice, eg. a cylindrical one.
2) You can write out coordinate data e.g. (sys2.r,sys2.phi,sys2.z) just as you would write out any data.
3) data will by default be exported within the mesh points, so you will get additionally (x,y,z) out which I don't think yopu can suppress
4) if you need your data e.g. on a cylindrical grid, you may want to defrine those points r(i), phi(i), z(i) in a data file and chose the export option "points to evaluate in" --> "from file".

This should bring you a step further to what you want to achieve - if not, let me know.

Sven
Hi Daniel, 1) you can define under definitions a coordinate system of your choice, eg. a cylindrical one. 2) You can write out coordinate data e.g. (sys2.r,sys2.phi,sys2.z) just as you would write out any data. 3) data will by default be exported within the mesh points, so you will get additionally (x,y,z) out which I don't think yopu can suppress 4) if you need your data e.g. on a cylindrical grid, you may want to defrine those points r(i), phi(i), z(i) in a data file and chose the export option "points to evaluate in" --> "from file". This should bring you a step further to what you want to achieve - if not, let me know. Sven

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 9 feb 2015, 08:16 GMT-5
Hello,
Thank you. Finally I used java to do the following:
- loop over a regular grid in my custom coordinate system
- using a 4x4 transformation matrix T (rotation+translation) I transform these points to the global CS
- write out the (x,y,z) coordinates of the points in the global CS into a file
- define this file as the set of points for evaluation, as you suggested in point 4)
- In order that the electric field (which is a vector quantity) be written out finally in my custom CS, I define 3 quantities to be exported: Rxx*Ex+Rxy*Ey+Rxz*Ez, Ryx*Ex+Ryy*Ey+Ryz*Ez, Rzx*Ex+Rzy*Ey+Rzz*Ez, where the R matrix is the rotational part (upper left 3x3 matrix) of the inverse of T
- The output file now contains the global (x,y,z) coordinates and the transformed E-field components, so I post-process this file and transform these global coordinates to the local ones using the inverse of the T matrix. I write out the transformed coordinates and the field components to my final fieldmap file.
This works.
Hello, Thank you. Finally I used java to do the following: - loop over a regular grid in my custom coordinate system - using a 4x4 transformation matrix T (rotation+translation) I transform these points to the global CS - write out the (x,y,z) coordinates of the points in the global CS into a file - define this file as the set of points for evaluation, as you suggested in point 4) - In order that the electric field (which is a vector quantity) be written out finally in my custom CS, I define 3 quantities to be exported: Rxx*Ex+Rxy*Ey+Rxz*Ez, Ryx*Ex+Ryy*Ey+Ryz*Ez, Rzx*Ex+Rzy*Ey+Rzz*Ez, where the R matrix is the rotational part (upper left 3x3 matrix) of the inverse of T - The output file now contains the global (x,y,z) coordinates and the transformed E-field components, so I post-process this file and transform these global coordinates to the local ones using the inverse of the T matrix. I write out the transformed coordinates and the field components to my final fieldmap file. This works.

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.