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

You are not logged in.

#1 2020-11-18 17:53:39

GPSalachs
Member
Registered: 2018-03-10
Posts: 216

Create a field from different Crea_Champ with Formule

Hello,

I would like to know, how to create a single field between two crea_champ commands in order to create then a result.
I am able to divide the information i want, meaning, the real and imaginary parts of displacement from a modal analysis but i cannot
figure out how to apply the formula i want and then create the combined field.

At the moment i have arrived here:

for i in range(nb_modes_exp):
    CHMCE i = CREA_CHAMP(NOM_CHAM='DEPL',
                    NUME_ORDRE=l_modes_exp i ,
                    OPERATION='EXTR',
                    RESULTAT=MODNUM,
                    TYPE_CHAM='NOEU_DEPL_C')
   
    VRExpR i = CREA_CHAMP(CHAM_GD=CHMCE i,
                    NUME_DDL=NDLLNUM,
                    OPERATION='C2R',
                    PARTIE='REEL',
                    TYPE_CHAM='NOEU_DEPL_R')
                   
    VRExpI i = CREA_CHAMP(CHAM_GD=CHMCE i ,
                    NUME_DDL=NDLLNUM,
                    OPERATION='C2R',
                    PARTIE='IMAG',
                    TYPE_CHAM='NOEU_DEPL_R') 

Would you have any suggestions to give me?

"The " i " should have been inside parenthesis but i am getting a forum error saying :
    i was opened within itself, this is not allowed

Offline

#2 2020-12-01 14:56:29

Ioannis
Member
Registered: 2016-04-01
Posts: 55

Re: Create a field from different Crea_Champ with Formule

Hi GPSalachs

I am showing here a simple example I used to extract the maximum velocities from an analysis (resDyna) and to create two fields, one with the squared values and one with the signed squared values. It can be helpful for your case. Or you already know this but your problem is how to consider two fields?

PS: you should put any code in brackets with the word code inside (see here h ttps://www.code-aster.org/forum2/help.php#bbcode)

f_square = FORMULE(
    NOM_PARA = ('DZ',),
    VALE = 'DZ**2'
)

f_signSq = FORMULE(
    NOM_PARA = ('DZ',),
    VALE = 'DZ*abs(DZ)'
)

vite_ch = CREA_CHAMP(
    OPERATION = 'EXTR',
    RESULTAT = resDyna,
    NOM_CHAM = 'VITE',
    TYPE_CHAM = 'NOEU_DEPL_R',
    TYPE_MAXI = 'NORM_TRAN',
    TYPE_RESU = 'VALE'
)

vite_fun = CREA_CHAMP(
    OPERATION = 'AFFE',
    TYPE_CHAM = 'NOEU_NEUT_F',
    # MODELE = model,
    MAILLAGE = mesh0,
    AFFE = (
        _F(
            TOUT = 'OUI',
            NOM_CMP = ('X1', 'X2'),
            VALE_F = (f_square, f_signSq)
        )
    )
)

vite = CREA_CHAMP(
    TYPE_CHAM = 'NOEU_NEUT_R',
    OPERATION = 'EVAL',
    CHAM_F = vite_fun,
    CHAM_PARA = vite_ch
)

res_Vite = CREA_RESU(
    OPERATION = 'AFFE',
    TYPE_RESU = 'EVOL_ELAS',
    NOM_CHAM = 'UT01_NOEU',
    AFFE = (
        _F(
            CHAM_GD = vite,
            INST = 0
        )
    )
)

Aether Engineering
- aethereng.com -

Offline

#3 2020-12-02 08:07:00

GPSalachs
Member
Registered: 2018-03-10
Posts: 216

Re: Create a field from different Crea_Champ with Formule

Hello,

thank you very much for the example you have given me! It was indeed usefull for
combining different pieces of data all toghether because i thought it would be done once
all the interested pieces were added to a single table so to manipulate later the table with formulas.
Thank you also very much for the link, i have completely missed the forums usage code!

Offline