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

You are not logged in.

## #1 2022-01-20 11:40:50

davhari
Member
Registered: 2021-12-13
Posts: 10

### Manipulation and storage of fields CREA_CHAM, CREA_RESU

Dear all.

I have the following general problem to solve:
(1) set up a linear elasticity analysis: mesh, model, fieldmat, load and resu,
(2) calculate result fields based on the results and user-defined functions: CALC_CHAMP,
(3) convert those result fields into usable fields: CREA_CHAM,
(4) create a new usable scalar field (say s1) by operating the ones created in (3),
(5) create a usable tensor field as t = (SIXX = s1, SIYY=s1, SIZZ = s1, SIXY = 0.0),  [I am in plane strain] and
(6) create a load based on the tensor field t: AFFE_CHAR_MECA --> PRE_SIGM.

(I say usable field since the ones created by CALC_CHAMP are results and as far as I understand can't be used in a model)

So far I have a code that handles (1), (2) and (3)--I leave all the required files attached--and I know how to do (6). However, I am quite lost in the way code_aster manages information and so I just can't figure out what I have to do next. So based on the attached files let me ask you the following questions for the concepts that I don't really understand.

Question 1:
Here I understand that Code_Aster creates three variables: 'UT02_NOEU', 'UT03_NOEU' and 'UT04_NOEU' and 'UT02_NOEU' has as well two components: 'X1' and 'X2'. Do 'UT03_NOEU' and 'UT04_NOEU' have components 'X3' and 'X4' or just 'X1'? Do 'UT02_NOEU', 'UT03_NOEU' and 'UT04_NOEU' belong exclusively to 'resu' and so if I create another result, say 'resu1', it could have the same 'UT\$\$_NOEU?

``````resu = CALC_CHAMP(CHAM_UTIL = _F(FORMULE = (Shyd_f, Soct_f),
NOM_CHAM = 'SIGM_NOEU',
NUME_CHAM_RESU = 2),
RESULTAT = resu,
reuse = resu)
resu = CALC_CHAMP(CHAM_UTIL = (_F(FORMULE = (Sgrw_f),
NOM_CHAM = 'UT02_NOEU',
NUME_CHAM_RESU = 3),
_F(FORMULE = (Sflag_f),
NOM_CHAM = 'UT02_NOEU',
NUME_CHAM_RESU = 4)),
RESULTAT = resu,
reuse = resu)``````

Question 2:
What are the components of grw_str and grw_flg? Could I change NOM_CMP in toGrw to say 'X2' or whatever?

``````grw_str = CREA_CHAMP(OPERATION = 'EXTR',
TYPE_CHAM = 'NOEU_NEUT_R',
NOM_CHAM = 'UT03_NOEU',
RESULTAT = resu)
grw_flg = CREA_CHAMP(OPERATION = 'EXTR',
TYPE_CHAM = 'NOEU_NEUT_R',
NOM_CHAM = 'UT04_NOEU',
RESULTAT = resu)
toGrw = CREA_CHAMP(OPERATION = 'AFFE',
TYPE_CHAM =  'NOEU_NEUT_F',
MODELE = mode,
AFFE = _F(NOM_CMP = ("X1"),
TOUT = 'OUI',
VALE_F = toGrw_f),
)``````

Question 3: This is the part that I am absolutely confused about. This works but I just don't know what it is doing. Where do 'X1' and 'X2' come from? How could I indicate that I want something from each grw_str, grw_flg and toGrw?

``````FMULT = FORMULE(NOM_PARA = ('X1', 'X2'), VALE = 'X1 *X2')
test_mul = CREA_CHAMP(OPERATION = 'AFFE',
TYPE_CHAM = 'NOEU_NEUT_F',
MODELE = mode,
AFFE = _F(TOUT = 'OUI',
NOM_CMP = ("X1"), VALE_F = FMULT))``````

Question 4: Why does resu_tg work well while resu_tst doesn't (I get the error: "Untreated CMP")? What is exactly TYPE_RESU?

``````resu_tg = CREA_RESU(OPERATION = 'AFFE',
TYPE_RESU = 'EVOL_VARC',
NOM_CHAM = 'NEUT',
AFFE = _F(CHAM_GD = toGrw, INST = 1))
resu_tst = CREA_RESU(OPERATION = 'AFFE',
TYPE_RESU = 'EVOL_VARC',
NOM_CHAM = 'NEUT',
AFFE = _F(CHAM_GD = test_mul, INST = 1))``````

Question 5: In general, I would like to know how to access and manipulate the information from each field.

Offline

## #2 2022-01-20 11:44:46

davhari
Member
Registered: 2021-12-13
Posts: 10

Here the files.

Attachments:

Offline

## #3 2022-01-20 15:11:32

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

### Re: Manipulation and storage of fields CREA_CHAM, CREA_RESU

hello

two points

1- many files are missing to run the problem

2- what are you exactly trying to do
i mean as an end results
the detailed path depicted in the  .comm  file seems very tortuous to me
there may be more direct ways to reach the goal

jean pierre aubry

freely available here https://framabook.org/beginning-with-code_aster/

Offline

## #4 2022-01-20 16:06:44

davhari
Member
Registered: 2021-12-13
Posts: 10

### Re: Manipulation and storage of fields CREA_CHAM, CREA_RESU

Hello Jean Pierre.

I could solve most of the problems I stated. I decided to read the documentation in french which is way more clear and in fact my french is not as bad as I thought. In addition, the use of INFO=2 was very revealing and I could understand what each field is. So, I am very sorry for not having read the documentation properly.

However, there is one think that I found very very inconvenient, so I hope there is a better way to do it. This is the situation:
The fields created by the following lines have components 'X1', 'X2', and so on and I could not find a way to name them differently.

``````# Hydrostatic stress field
Shyd_f = FORMULE(NOM_PARA = ('SIXX', 'SIYY', 'SIZZ'),
VALE = 'Shyd_pln_str(SIXX, SIYY, SIZZ)', Shyd_pln_str =
Shyd_pln_str)
Soct_f = FORMULE(NOM_PARA = ('SIXX', 'SIYY', 'SIZZ', 'SIXY'),
VALE = 'Soct_pln_str(SIXX, SIYY, SIZZ, SIXY)',
Soct_pln_str = Soct_pln_str)
resu = CALC_CHAMP(CHAM_UTIL = _F(FORMULE = (Shyd_f, Soct_f),
NOM_CHAM = 'SIGM_NOEU',
NUME_CHAM_RESU = 2),
RESULTAT = resu,
reuse = resu)
# Growth stress as result
Sgrw_f = FORMULE(NOM_PARA = ('X1', 'X2'),
VALE = 'Sgrowth(X1, X2, alpha)', Sgrowth = Sgrowth,
alpha = alpha)
Sflag_f = FORMULE(NOM_PARA = ('X1', 'X2'),
VALE = 'Sgrowth_flag(X1, X2, alpha)',
Sgrowth_flag = Sgrowth_flag, alpha = alpha)
resu = CALC_CHAMP(CHAM_UTIL = (_F(FORMULE = (Sgrw_f, Sflag_f),
NOM_CHAM = 'UT02_NOEU',
NUME_CHAM_RESU = 3)),
RESULTAT = resu,
reuse = resu)
# Growth stress as field
grw_fi = CREA_CHAMP(OPERATION = 'EXTR',
TYPE_CHAM = 'NOEU_NEUT_R',
NOM_CHAM = 'UT03_NOEU',
RESULTAT = resu,
#                     INFO = 2
)``````

At first I did not found any problem but when I realised that CREA_CHAMP --> AFFE --> VALE_F requires CREA_CHAMP --> EVAL --> CHAM_PARA to create a numeric field I also saw that if in CHAM_PARA I have say ch1 and ch2 as fields from CALC_CHAMP --> CREA_CHAMP --> EXTR both fields will have components X1 and then the program cannot recognise which X1 is X1 in a formula. In other words, I realised that if I wanted to compute to fields the name of their components should be different. I I don't know how to do that from CALC_CHAMP --> CREA_CHAMP --> EXTR.

Finally, the attached file should work, provided the workDir variable is set correctly and it includes most of the things I wanted to do.

Sorry for the verbosity and thank you very much for your reply.

Last edited by davhari (2022-01-20 16:07:20)

Attachments:

Offline

## #5 2022-01-20 16:14:41

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

### Re: Manipulation and storage of fields CREA_CHAM, CREA_RESU

i repeat myself more clearly
what do you want do to do with these CREA_CHAMP?
is not there a way to use the result as a whole as imput to a new calculation?

freely available here https://framabook.org/beginning-with-code_aster/

Offline

## #6 2022-01-20 17:24:01

davhari
Member
Registered: 2021-12-13
Posts: 10

### Re: Manipulation and storage of fields CREA_CHAM, CREA_RESU

I want to create a stress field (strField) to assign it to a load as:

``load = AFFE_CHAR_MECA(MODELE = mo, PRE_SIGM = (_F(SIGM = strField))) ``

and then use that load to do another mechanical analysis.

In addition I have another field (strYes) that is mainly zeros or ones so that the load in reality is defined by "SIGM = strField*strYes". However, this strYes is also updated after each iteration depending no the values of strField. Let us say I create a third field strYYes from the information from strField, then I update strYes = strYes*strYYes and finally I can define the load as strField*strYes.

So at the end I need to be able to keep strYes for the next iteration.

Offline