Welcome to the forums. Please post in English or French.

You are not logged in.

## #1 2019-03-28 16:18:51

marcoC
Member
Registered: 2018-06-13
Posts: 43

### Weight and center of gravity calculation

Hi,

I would like to calculate weight and center of gravity position for a large model with many surface groups.

The weight can be calculated applying only GRAVITE and computing the sum of the vertical reaction on restraint nodes.

Is it possible to calculate the position of global center of gravity inside code aster ?

Regards,

MarcoC

Offline

## #2 2019-03-28 17:42:23

jeanpierreaubry
Guru
From: nantes (france)
Registered: 2009-03-12
Posts: 3,918

### Re: Weight and center of gravity calculation

hello

this is among the bare minimum of a finite element code!

once you have performed a calculation, here named 'stat', with MECA_STATIQUE or any other operator
you can do that

``````massin=POST_ELEM(
RESULTAT =stat,
MODELE=model,
MASS_INER=_F(
GROUP_MA=here the groups you want
),
TITRE= 'masse'
);

IMPR_TABLE (
TABLE=massin,
FORMAT_R='1PE12.3',
)``````

this appears at least ten times in the examples of my book!!!

jean pierre aubry

Last edited by jeanpierreaubry (2019-03-28 17:43:13)

consider reading my book
freely available here https://framabook.org/beginning-with-code_aster/

Offline

## #3 2019-03-29 10:01:19

marcoC
Member
Registered: 2018-06-13
Posts: 43

### Re: Weight and center of gravity calculation

Jeanpierre,

I have red your very useful book, but the method you suggest is not the answer to my question.
I spoke of "global center of mass". Suppose that you have a lot of face groups, the question is:
is it possible to calculate the center of mass coordinates of the whole model ?
The method you suggest gives, as output, a list of masses, coordinates of center of mass of each group.
Without importing the list in a spreadsheet, is it possible to have the center of mass position of the whole model inside code aster ?
I have tried this script:

mesh = DEFI_GROUP(
CREA_GROUP_MA=_F(
NOM='all_ma',
TOUT='OUI'
),
MAILLAGE=mesh
)

.....

mass = POST_ELEM(
MASS_INER=_F(
GROUP_MA=('all_ma', )
),
MODELE=model,
RESULTAT=reslin
)

but this produces an error:

EXECUTION_CODE_ASTER_EXIT_10657-0001-antix1=2

<I>_EXIT_CODE = 2

Regards,

marcoC

Offline

## #4 2019-03-29 16:35:31

jeanpierreaubry
Guru
From: nantes (france)
Registered: 2009-03-12
Posts: 3,918

### Re: Weight and center of gravity calculation

it will work if you create with UNION a group containing all the groups of interest
there is somewhere in the book an example of UNION

in the second edition i have a special paragraph how dangereous it is to use TOUT='OUI' in creating a group as you may introduce some elements where the mass does not have any meaning

consider reading my book
freely available here https://framabook.org/beginning-with-code_aster/

Offline

## #5 2019-03-29 18:47:53

marcoC
Member
Registered: 2018-06-13
Posts: 43

### Re: Weight and center of gravity calculation

Jeanpierre,

I have tried the option UNION:

mesh = DEFI_GROUP(
CREA_GROUP_MA=_F(
NOM='all_ma',
UNION=('reinf_fr_fl_thk_15_40', 'reinf_fr_fl_thk_15_46', 'reinf_fr_fl_thk_15_44', 'deck_plate_thk_9_81', 'stiffener_thk_10_68', 'deck_plate_thk_9_86', 'deck_plate_thk_9_87', 'deck_plate_thk_9_89', 'deck_plate_thk_9_13', 'deck_plate_thk_9_17', 'stiffener_thk_9_102', 'x_contour_web_thk_10_3', 'reinf_fr_w_thk_10_133', 'reinf_fr_fl_thk_15_145', 'deck_plate_thk_9_22', 'stiffener_thk_10_128', 'stiffener_thk_10_129', 'stiffener_thk_10_124', 'stiffener_thk_10_125', 'stiffener_thk_10_10', ...)
),
MAILLAGE=mesh
) # sequences have been limited to the first 20 occurrences.

........

mass = POST_ELEM(
MASS_INER=_F(
GROUP_MA=('all_ma', )
),
MODELE=model,
RESULTAT=reslin
)

.......

IMPR_TABLE(
FORMAT='TABLEAU',
FORMAT_R='E12.5',
NOM_PARA=('LIEU', 'ENTITE', 'MASSE', 'CDG_X', 'CDG_Y', 'CDG_Z'),
TABLE=mass,
UNITE=8
)

But result is still the error:

EXECUTION_CODE_ASTER_EXIT_29247-0001-antix1=2

<I>_EXIT_CODE = 2

Regards,

marcoC

Offline

## #6 2019-03-29 19:26:13

jeanpierreaubry
Guru
From: nantes (france)
Registered: 2009-03-12
Posts: 3,918

### Re: Weight and center of gravity calculation

without the mesh i cannot say anything

consider reading my book
freely available here https://framabook.org/beginning-with-code_aster/

Offline

## #7 2019-03-29 19:37:01

marcoC
Member
Registered: 2018-06-13
Posts: 43

Here it is.

Offline

## #8 2019-03-29 19:44:57

marcoC
Member
Registered: 2018-06-13
Posts: 43

### Re: Weight and center of gravity calculation

Here it is the link.

ht://we.tl/t-WoZsx3KsRm

Offline

## #9 2019-03-30 08:15:50

jeanpierreaubry
Guru
From: nantes (france)
Registered: 2009-03-12
Posts: 3,918

### Re: Weight and center of gravity calculation

i do not understand what you are doing
i had like to see the .comm file
as the attached .comm file with dummy values gives a result

Attachments:

consider reading my book
freely available here https://framabook.org/beginning-with-code_aster/

Offline

## #10 2019-03-30 17:57:03

marcoC
Member
Registered: 2018-06-13
Posts: 43

### Re: Weight and center of gravity calculation

Thank you Jeanpierre,

attached is my .comm file.

In my case it doesn't work, may be there is confusion in the groups.
If you eliminate all_ma group, and mass object, it works.

Regards,

Marco

Attachments:

Offline

## #11 2019-03-31 10:56:01

jeanpierreaubry
Guru
From: nantes (france)
Registered: 2009-03-12
Posts: 3,918

### Re: Weight and center of gravity calculation

on my 14.2 code_aster stand alone it works ok and gives

``````##ASTER 14.02.00 CONCEPT mass CALCULE LE 31/03/2019 A 09:53:19 DE TYPE
#TABLE_SDASTER
LIEU                     ENTITE   MASSE        CDG_X        CDG_Y        CDG_Z
all_ma                   GROUP_MA  9.18257E+00  8.24499E+03 -8.34958E+03  2.39387E+04``````

consider reading my book
freely available here https://framabook.org/beginning-with-code_aster/

Offline

## #12 2019-03-31 11:28:15

marcoC
Member
Registered: 2018-06-13
Posts: 43

### Re: Weight and center of gravity calculation

Your .comm file works, but there is one group with one constant thickness.

My .comm file has many groups with different thickness. I have created one group (all_ma) with the union of all the groups

mesh = DEFI_GROUP(
CREA_GROUP_MA=_F(
NOM='all_ma',
UNION=('reinf_fr_fl_thk_15_40', 'reinf_fr_fl_thk_15_46', 'reinf_fr_fl_thk_15_44', 'deck_plate_thk_9_81', 'stiffener_thk_10_68', 'deck_plate_thk_9_86', 'deck_plate_thk_9_87', 'deck_plate_thk_9_89', 'deck_plate_thk_9_13', 'deck_plate_thk_9_17', 'stiffener_thk_9_102', 'x_contour_web_thk_10_3', 'reinf_fr_w_thk_10_133', 'reinf_fr_fl_thk_15_145', 'deck_plate_thk_9_22', 'stiffener_thk_10_128', 'stiffener_thk_10_129', 'stiffener_thk_10_124', 'stiffener_thk_10_125', 'stiffener_thk_10_10', ...)
),
MAILLAGE=mesh
) # sequences have been limited to the first 20 occurrences.

.....

mass = POST_ELEM(
MASS_INER=_F(
GROUP_MA=('all_ma', )
),
MODELE=model,
RESULTAT=reslin
)

....

IMPR_TABLE(
FORMAT='TABLEAU',
FORMAT_R='E12.5',
NOM_PARA=('LIEU', 'ENTITE', 'MASSE', 'CDG_X', 'CDG_Y', 'CDG_Z'),
TABLE=mass,
UNITE=8
)

But the file doesn't work:

Here the tail of the log file.

IMPR_RESU(FORMAT='RESULTAT',
UNITE=5,
RESU=_F(VALE_MAX='OUI',
VALE_MIN='OUI',
SOUS_TITRE='Max_Min_SigEqu',
FORMAT_R='1PE21.14',
RESULTAT=reslin,
NOM_CHAM=('SIEQ_ELNO', ),
IMPR_COOR='NON',
FORM_TABL='NON',),
INFO=1,
PROC0='OUI',)

EXECUTION_CODE_ASTER_EXIT_29247-0001-antix1=2

<I>_EXIT_CODE = 2

How can I fix it ?

Regards,

Marco

Offline

## #13 2019-03-31 13:22:40

jeanpierreaubry
Guru
From: nantes (france)
Registered: 2009-03-12
Posts: 3,918

### Re: Weight and center of gravity calculation

my previous post is from your .comm file and .med file

and more generally in the mess file look at the output of the command it self, not at the end of the file

consider reading my book
freely available here https://framabook.org/beginning-with-code_aster/

Offline

## #14 2019-04-02 11:05:29

marcoC
Member
Registered: 2018-06-13
Posts: 43

### Re: Weight and center of gravity calculation

Jeanpierre,

I am running on salome meca 2018 and my .comm file doesn't work.

I am trying to install code aster 14 on my machine, but an error, during installation, occurred:

Installation of   : hdf5 1.8.14
HDF5 is a Hierarchical Data Format product consisting of a data format
specification and a supporting library implementation. HDF5 is designed to
address some of the limitations of the older HDF product and to address current
and anticipated requirements of modern systems and applications.
Archive filename  : hdf5-1.8.14
Destination       : /home/marco/aster-full-src-14.2.0/public/hdf5-1.8.14
Working directory : /tmp/install_hdf5.1087
--------------------------------------------------------------------------------

Filling cache...                                                       [  OK  ]
Checking permissions...                                                [  OK  ]
Product 'hdf5' is already installed.
Choose 'no' to keep the current installation, 'yes' to force its re-installation (y/n, default no)

Any hint ?

Regards,

Marco

Offline