[CIG-SHORT] Cell centroids
Carl W Gable
gable at lanl.gov
Mon Sep 10 06:21:31 PDT 2012
You can compute centroids of hex (or line, tri, quad, prism, pyramid,
tet) with LaGriT.
You have to output the mesh in a format LaGriT can read (eg. Abaqus)
export abaqus "file_name" overwrite cubitids
I convert the abaqus to AVS format with the awk script below (script
below is hardwired for quads).
Then the following LaGriT command compute the centroid and output it to
a file in 3 column ascii.
read / avs / file_name_in / mo
createpts / median
dump / avs2 / file_name_out / mo / 0 0 0 2
finish
Cheers,
Carl Gable
0 0 0 3 0
00003 1 1 1
xmed, real
ymed, real
zmed, real
0.142157819824E+05 0.222367900391E+05 0.623520860076E+01
0.143572114258E+05 0.222202792969E+05 0.708197271824E+01
0.144949233398E+05 0.222228002930E+05 0.781360983849E+01
0.146261022949E+05 0.222358046875E+05 0.813354587555E+01
0.147520295410E+05 0.222421035156E+05 0.823126870394E+01
tessellate.lanl.gov:shell% cat abaqus2avs.awk
# this converts abacus quad file to avs
# awk -f abacus2avs.awk input.inp
#
BEGIN{ FS=","; ipt=0; iquad=0; IN_NODE=0; IN_QUAD=0; }
{
# look for key words
# *NODE, NSET=ALLNODES
# *ELEMENT, TYPE=S4R, ELSET=EB1
if ($1 == "*NODE") {IN_NODE = 1; }
if ($1 == "*ELEMENT") {IN_NODE=0; IN_QUAD = 1; }
if (IN_NODE==1 && NF==4) {
ipt=ipt+1
xic[ipt]= $2
yic[ipt]= $3
zic[ipt]= $4
if ($1 == "**") {IN_NODE = 0}
}
if (IN_QUAD==1 && NF==5) {
iquad=iquad+1
q1[iquad]= $2
q2[iquad]= $3
q3[iquad]= $4
q4[iquad]= $5
if ($1 == "**") {IN_QUAD = 0}
}
} END {
FS=" "
print ipt, iquad," 0 0";
for (i=1; i<=ipt; i=i+1) {
printf(" %10d %14.4f %14.4f %7.4f\n",i, xic[i], yic[i], elev ) }
for (i = 1; i <= (iquad); i = i + 1){
printf(" %10d 1 quad %10d %10d %10d %10d\n",i, q1[i], q2[i],
q3[i], q4[i] ) }
}
tessellate.lanl.gov:shell%
On 09/08/2012 08:33 PM, Matthew Knepley wrote:
> On Sat, Sep 8, 2012 at 9:29 PM, Birendra jha <bjha7333 at yahoo.com
> <mailto:bjha7333 at yahoo.com>> wrote:
>
> Hi
>
> Does anyone know if it is possible to compute and output cell
> centroid coordinates from CUBIT?
>
> If not in CUBIT, is there some other tool (c++ code etc.) for this?
>
> I need it for unstructured hexahedral grid. From google I found:
> http://www.cs.berkeley.edu/~jfc/mirtich/massProps.html
> <http://www.cs.berkeley.edu/%7Ejfc/mirtich/massProps.html>
> which I tried to use but I don't understand why it does not work
> for general hexahedron.
>
>
> The way that makes sense in PyLith is to take the middle point in the
> reference element,
> (0.0,0.0,0.0) I believe, and transform it using the FE Jacobian
> inverse for that point. We
> have these routines since they are used for point location.
>
> Matt
>
> Thanks a lot
> Birendra
> _______________________________________________
> CIG-SHORT mailing list
> CIG-SHORT at geodynamics.org <mailto:CIG-SHORT at geodynamics.org>
> http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short
>
>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which
> their experiments lead.
> -- Norbert Wiener
>
>
> _______________________________________________
> CIG-SHORT mailing list
> CIG-SHORT at geodynamics.org
> http://geodynamics.org/cgi-bin/mailman/listinfo/cig-short
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Dr. Carl W. Gable, Staff Scientist
Acting Group Leader, EES-16, Computational Earth Sciences
MS T003, Los Alamos National Laboratory, Los Alamos NM 87545
Email:gable at lanl.gov Voice:505-665-3533 Fax:505-665-8737
Homepage: http://www.ees.lanl.gov/staff/gable
LaGriT Mesh Generation Software: http://lagrit.lanl.gov
Mesh Generation, Geological Apps: http://meshing.lanl.gov
Focus:Geophysics, Hydrology, Mesh Generation, Computational Geometry
Schedule B
/\/\/\/\/\/\/\/\/\/\/Correspondence / TSPA\/\/\/\/\/\/\/\/\/\/\/\/\/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://geodynamics.org/pipermail/cig-short/attachments/20120910/f794dbb1/attachment.htm
More information about the CIG-SHORT
mailing list