Discussion Forum

exact format in mphtxt file.

Topics: no topics

Thread index  |  Previous thread  |  Next thread  |  Start a new discussion

RSS FeedRSS feed   |   Email notificationsTurn on email notifications   |   3 Replies   Last post: March 12, 2010 6:54am UTC
sangpil yoon

sangpil yoon

February 26, 2010 9:17pm UTC

exact format in mphtxt file.

I want to export mesh data from COMSOL so that I can run my own FE solver to compare FE results.

I find importing FE results to COMSOL is relatively simple.
But reading mphtxt is not.

as an example, i am reading "reactive_muffler.mphtxt" from COMSOL. (for simplicity, I didnt write whole lines)

==================================================
.....
3 # number of element types
# Type #0
3 vtx # type name

1 # number of nodes per element
10 # number of elements
# Elements


# Type #1
3 edg # type name

2 # number of nodes per element
68 # number of elements
# Elements


# Type #2
3 tri # type name

3 # number of nodes per element
252 # number of elements
# Elements


252 # number of domains
# Domains
==========================================================

here are my questions.

1. from the above example, can I assume

Type #0 == vtx element
Type #1 == edg element
Type #2 == tri element

2. what do integers in fromt of elem type represent ?

3 vtx # type name
3 edg # type name
3 tri # type name


3. In the following line, can i assume that this is ono-to-one relation of 'elem # - subdomain # in the model'? (in this reactive_muffler example, i see 3 subdomains)


252 # number of domains
# Domains
1 element 1 is in the subdomain #1
1 element 2 is in the subdomain #1
2 element 3 is in the subdomain #2
3 element 4 is in the subdomain #3
.


4. i am writing a fortran code to read a mphtxt file.
the line '3 tri # type name' is a fixed format? that is,

one digit intger + three letter elem format (like tri, edg,...) + '#' + 'type name'

any suggestions on reading mphtxt file using fortran?

my situation tells me that i wont deal with FE elem other than '2D 9 node' == quadrilateral (quad2) at this point.




5. where i can find more detailed info about mphtxt?

document "6 The Multiphysics COMSOL Files" didnt help me that much.




well. i hope i describe my question clearly....

and thanks in advance for any comments.



Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Pasquale Franciosa

Pasquale Franciosa

March 11, 2010 10:22am UTC in response to sangpil yoon

Re: exact format in mphtxt file.

Hi,
if I well understand you need to export mesh data. If so, you can extract data by using matlab.
Try the following:
1. export fem structure; then, from matlab:
2. nodes=get(fem.mesh,'p'); ele=get(fem.mesh,'el')
3. finally, format this data based on your needs.

Hope this may help

Regards

Pasquale

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

sangpil yoon

sangpil yoon

March 11, 2010 5:02pm UTC in response to Pasquale Franciosa

Re: exact format in mphtxt file.

Hi,

Thanks for your reply.

The thing is that I want to avoid using matlab.

I know its a lot easier if i can use matlab but at this point i;d like to use just mphtxt file forms.

Thanks anyway

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Saswati  Roy

Saswati Roy

March 12, 2010 6:54am UTC in response to sangpil yoon

Re: exact format in mphtxt file.

Hi,
Following are the answers to some of your questions:
1) Yes, your assumption is correct.
2) The number represents the number of characters in the string (e.g. 'tri') that follows the number. E.g. 4 quad
3) I am afraid that I did not understand this question. From what I can make out of the code that you had provided: there is one subdomain with 252 elements of triangular shape and each triangle defined by 3 mesh points.
4) Whatever follows after # is basically a comment and can be disregarded.
5) See the 'femmesh' function in the documentation. You can try to figure out a lot of the stuffs by looking at the file for a very simple mesh, say a rectangular mesh with 4 elements only.
Best wishes,
Saswati

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse


Rules and guidelines