Re: [Gmsh] Reduce number of digits in key-format file

2020-03-20 Thread Xingsheng Sun
Dear Christophe and Winfried,

Thank you so much for your help. The problem has been solved.

The reason is that LS-DYNA can only read 16 digits, while in the output
file of Gmsh some numbers have 17 digits. For example, in my previous
email 0.0124976
has 17 digits including the dot, which cannot be read by LS-DYNA. I also
found that the 17-digit numbers only happen when its value is close to
zero. Then I moved the entire mesh by 1 in all x-, y- and z-coordinates.
Then the output file by Gmsh works well for LS-DYNA.

Hope the solution helps the people who might have the same problem.

Best wishes,
Xingsheng

On Fri, Mar 20, 2020 at 4:23 AM Winfried Boxleitner <
winfried.boxleit...@ait.ac.at> wrote:

> dear Christophe,
> my awk-script is meant as an example only, howto modify the msh-file
> after creation. for users not familiar to commandline tools however, this
> is not useful. I personally have no problems with the current format.
> remark: until now I only used msh version 2, because this can be used
> together with FreeFem.
>
>
> Winfried
>
> On Fri, 20 Mar 2020, Christophe Geuzaine wrote:
>
> >
> >
> >> On 20 Mar 2020, at 07:59, Winfried Boxleitner <
> winfried.boxleit...@ait.ac.at> wrote:
> >>
> >> dear Xingsheng,
> >> if you are used to commandline you can modify my awk-script to fit your
> needs.
> >>
> >> to format the mesh file use the following command:
> >> awk -f pretty_print_msh.awk input.msh > output.msh
> >>
> >
> > Do you mean that we should use %12.6g in our KEY export?
> >
> > Christophe
> >
> >
> >> the awk-script is attached
> >>
> >> best regards,
> >> Winfried
> >>
> >>
> >> On Thu, 19 Mar 2020, Xingsheng Sun wrote:
> >>
> >>> Hello All,
> >>>
> >>> I am using Gmsh to generate the mesh file for Ls-dyna. The problem is
> that
> >>> in the key-format file generated by Gmsh, the coordinates of nodes
> have too
> >>> many digits. For instance, in the node information:
> >>>
> >>> *NODE
> >>> 22, 0, 0.0124976, -0.001
> >>> 23, 0, 0.024995, -0.001
> >>> 24, 0, 0.0374926, -0.001
> >>> 25, 0, 0.0499907, -0.001
> >>>
> >>> the y-coordinates of nodes 22-25 have 15 digits that cannot be read by
> >>> Ls-dyna.
> >>>
> >>> So could any people shed light on how to reduce the number of digits in
> >>> Gmsh? I am using command lines, not GUI. Thank you so much in advance.
> >>>
> >>> Best regards,
> >>> Xingsheng
> >>>
> >>
> >>
> >>  __
> >> /
> >> | Winfried Boxleitner
> >> | Scientist
> >> | AIT Austrian Institute of Technology GmbH
> >>
> \_
> >> gmsh mailing list
> >> gmsh@onelab.info
> >> http://onelab.info/mailman/listinfo/gmsh
> >
> > —
> > Prof. Christophe Geuzaine
> > University of Liege, Electrical Engineering and Computer Science
> > http://www.montefiore.ulg.ac.be/~geuzaine
> >
> >
___
gmsh mailing list
gmsh@onelab.info
http://onelab.info/mailman/listinfo/gmsh


Re: [Gmsh] Reduce number of digits in key-format file

2020-03-20 Thread Winfried Boxleitner

dear Christophe,
my awk-script is meant as an example only, howto modify the msh-file
after creation. for users not familiar to commandline tools however, this
is not useful. I personally have no problems with the current format.
remark: until now I only used msh version 2, because this can be used
together with FreeFem.


Winfried

On Fri, 20 Mar 2020, Christophe Geuzaine wrote:





On 20 Mar 2020, at 07:59, Winfried Boxleitner  
wrote:

dear Xingsheng,
if you are used to commandline you can modify my awk-script to fit your needs.

to format the mesh file use the following command:
awk -f pretty_print_msh.awk input.msh > output.msh



Do you mean that we should use %12.6g in our KEY export?

Christophe



the awk-script is attached

best regards,
Winfried


On Thu, 19 Mar 2020, Xingsheng Sun wrote:


Hello All,

I am using Gmsh to generate the mesh file for Ls-dyna. The problem is that
in the key-format file generated by Gmsh, the coordinates of nodes have too
many digits. For instance, in the node information:

*NODE
22, 0, 0.0124976, -0.001
23, 0, 0.024995, -0.001
24, 0, 0.0374926, -0.001
25, 0, 0.0499907, -0.001

the y-coordinates of nodes 22-25 have 15 digits that cannot be read by
Ls-dyna.

So could any people shed light on how to reduce the number of digits in
Gmsh? I am using command lines, not GUI. Thank you so much in advance.

Best regards,
Xingsheng




 __
/
| Winfried Boxleitner
| Scientist
| AIT Austrian Institute of Technology GmbH
\_
gmsh mailing list
gmsh@onelab.info
http://onelab.info/mailman/listinfo/gmsh


—
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine



signature.asc
Description: Digital Signature
___
gmsh mailing list
gmsh@onelab.info
http://onelab.info/mailman/listinfo/gmsh


Re: [Gmsh] Reduce number of digits in key-format file

2020-03-20 Thread Christophe Geuzaine


> On 20 Mar 2020, at 07:59, Winfried Boxleitner  
> wrote:
> 
> dear Xingsheng,
> if you are used to commandline you can modify my awk-script to fit your needs.
> 
> to format the mesh file use the following command:
> awk -f pretty_print_msh.awk input.msh > output.msh
> 

Do you mean that we should use %12.6g in our KEY export?

Christophe


> the awk-script is attached
> 
> best regards,
> Winfried
> 
> 
> On Thu, 19 Mar 2020, Xingsheng Sun wrote:
> 
>> Hello All,
>> 
>> I am using Gmsh to generate the mesh file for Ls-dyna. The problem is that
>> in the key-format file generated by Gmsh, the coordinates of nodes have too
>> many digits. For instance, in the node information:
>> 
>> *NODE
>> 22, 0, 0.0124976, -0.001
>> 23, 0, 0.024995, -0.001
>> 24, 0, 0.0374926, -0.001
>> 25, 0, 0.0499907, -0.001
>> 
>> the y-coordinates of nodes 22-25 have 15 digits that cannot be read by
>> Ls-dyna.
>> 
>> So could any people shed light on how to reduce the number of digits in
>> Gmsh? I am using command lines, not GUI. Thank you so much in advance.
>> 
>> Best regards,
>> Xingsheng
>> 
> 
> 
>  __
> /
> | Winfried Boxleitner
> | Scientist
> | AIT Austrian Institute of Technology GmbH
> \_
> gmsh mailing list
> gmsh@onelab.info
> http://onelab.info/mailman/listinfo/gmsh

— 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine




___
gmsh mailing list
gmsh@onelab.info
http://onelab.info/mailman/listinfo/gmsh


Re: [Gmsh] Reduce number of digits in key-format file

2020-03-20 Thread Winfried Boxleitner

dear Xingsheng,
if you are used to commandline you can modify my awk-script to fit your needs.

to format the mesh file use the following command:
awk -f pretty_print_msh.awk input.msh > output.msh

the awk-script is attached

best regards,
Winfried


On Thu, 19 Mar 2020, Xingsheng Sun wrote:


Hello All,

I am using Gmsh to generate the mesh file for Ls-dyna. The problem is that
in the key-format file generated by Gmsh, the coordinates of nodes have too
many digits. For instance, in the node information:

*NODE
22, 0, 0.0124976, -0.001
23, 0, 0.024995, -0.001
24, 0, 0.0374926, -0.001
25, 0, 0.0499907, -0.001

the y-coordinates of nodes 22-25 have 15 digits that cannot be read by
Ls-dyna.

So could any people shed light on how to reduce the number of digits in
Gmsh? I am using command lines, not GUI. Thank you so much in advance.

Best regards,
Xingsheng




  __
 /
| Winfried Boxleitner
| Scientist
| AIT Austrian Institute of Technology GmbH
 \__#==#
#  #
#  (c) AIT 2013, all rights reserved   #
#  #
#  Author: Winfried Boxleitner #
#  #
#==#
#
# remove unnecessary entries which are near 0
#
BEGIN{
  filter=0
  nodes=0
  limit=1.0e-20
}
### program loop ###
{
  ### for gmsh files:
  if($1 ~ /\$[A-Z][a-z]/) {filter=1}
  if($1 ~ /\$Node/)  {nodes=1}
  if($1 ~ /\$End[A-Z]/)   {filter=0; nodes=0}
  ### for other blocked text-output:
  if($1 ~ /#{/)   {filter=1; nodes=1}
  if($1 ~ /#}/)   {filter=0; nodes=0}
  ###
  if(filter == 1)
  { if($1 ~ "[0-9]")
{ if($1 ~ "\"" )
  { ### treat strings tags in gmsh files correctly, if they contain numbers
print $0
  }else{
printf "%5g ", $1
  }
  for(i=2;i<=NF;i++)
if(nodes > 0)
{ if(($i*$i)

signature.asc
Description: Digital Signature
___
gmsh mailing list
gmsh@onelab.info
http://onelab.info/mailman/listinfo/gmsh