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

You are not logged in.

#1 2020-04-09 17:22:01

ale_vizz
Member
Registered: 2020-04-09
Posts: 4

[SOLVED] extract NUME_DDL from code aster object to python int

Hello,
I am a relatively new user of code_aster and I find it amazing.
Congrats to the developers!

I have a very simple question:
how to produce a python integer that is equal to the number of dofs contained in object <nume_ddl_sdaster>?
I have tried nddl.valeurs() and nddl.EXTR.valeurs() but nothing works and I can't find any testcase where this has been done.

Thank you in advance

Last edited by ale_vizz (2020-04-16 16:51:29)

Offline

#2 2020-04-10 01:26:39

lsalles
Member
From: Imperial College London
Registered: 2011-09-27
Posts: 38

Re: [SOLVED] extract NUME_DDL from code aster object to python int

Hello,
There is no python function to extract data from a sd_nume_ddl. You will have to use the function getvectjev from the aster module.
Here is an example how to use it.

nom_nume='nddl'
#Getting the total number of equations
Nume=aster.getvectjev(nom_nume.ljust(8)+'      .NUME.NEQU        ' )
#We also need to get the arrays of the Lagrange multiplier condition
#if DELG(i) < 0 it is a Lagrange multiplier equation
DELG=aster.getvectjev(nom_nume.ljust(8)+'      .NUME.DELG        ' )
#counting Lagrange multipliers
nlag = len([i for i in DELG if i < 0])
#total number of equations
ntot = Nume[0]
#total number of physical unknowns
nphys = ntot-nlag

There may be an easiest way that I don't know. It would be a good idea that the developers of Code_Aster implement a python function to extract data from sd_nume_ddl.

Offline

#3 2020-04-10 08:52:55

hberro
Member
From: Palaiseau, France
Registered: 2011-07-05
Posts: 36

Re: [SOLVED] extract NUME_DDL from code aster object to python int

+1 for lsalles answer,

Another possibility is to use the aster.dismoi utility function that is accessible from python.

There are several "questions" that can be used to get information about data structures efficiently. The advantage of dismoi w.r.t. direct getvectjev calls is that dismoi is written in fortran and is kept updated even if the data structures themselves change.

The documentation : D6.07.05

It can also be useful for other data structures than nume_ddl !

Good luck with your study.

HB


Attachments:
Screenshot_20200410_094723.jpg, Size: 153.91 KiB, Downloads: 52

Offline

#4 2020-04-14 18:22:54

ale_vizz
Member
Registered: 2020-04-09
Posts: 4

Re: [SOLVED] extract NUME_DDL from code aster object to python int

Thanks both for the extensive reply!
They fully solved my issue

Offline

#5 2020-08-14 04:54:30

Nidish
Member
Registered: 2020-06-04
Posts: 18

Re: [SOLVED] extract NUME_DDL from code aster object to python int

Is there any good one-stop reference for the python scripting similar to the one lsalles posted?

Offline