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

You are not logged in.

#1 2022-01-19 11:25:08

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

[SOLVED] Use a CHAM_UTIL to create another CHAM_UTIL

I have a linear elasticity analysis and for the post-processing I have created 2 new fields with CALC_CHAMP and now I want to used those two fields to create a new one. Here I list what I have:

def fun1(...)
def fun2(...)
def fun3(...)

Linear analysis ...
resu = MECA_STATIQUE(...)

resu = CALC_CHAMP(reuse = resu, CONTRAINTE = ('SIGM_NOEU', 'SIGM_ELGA'), RESULTAT = resu)

f1 = FORMULE(NOM_PARA = ('SIXX', 'SIYY', 'SIZZ'), VALE = 'fun1(SIXX, SIYY, SIZZ)', fun1=fun1)
f2 = FORMULE(NOM_PARA = ('SIXX', 'SIYY', 'SIZZ'), VALE = 'fun2(SIXX, SIYY, SIZZ)', fun2=fun2)
f3 = FORMULE(NOM_PARA = ('X1', 'X2'), VALE = 'fun3(X1, X2'), fun3=fun3)

fields = CALC_CHAMP(CHAM_UTIL = _F(FORMULE = (f1, f2), NOM_CHAM = 'SIGM_ELGA', NUME_CHAM_RESU = 2), RESULTAT = resu)

This works fine and now I want to create another field with f3. I tried (just intuitively) the following, but it doesn't work:
newF = CALC_CHAMP(CHAM_UTIL = _F(FORMULE = (f3), NOM_CHAM = 'UT02_ELNO', NUME_CHAM_RESU = 3), RESULTAT = resu)

So, I would like to know how to use fields to create a new field just as we can use SIGM_ELGA.

Last edited by davhari (2022-01-19 15:37:03)

Offline

#2 2022-01-19 15:13:52

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

Re: [SOLVED] Use a CHAM_UTIL to create another CHAM_UTIL

hello

you are using using X1 an X2 but from which results or field

here is an example that works
(fessai has no physical meaning, just an example of use)

fsig = FORMULE(
	NOM_PARA=('SN','SMFY','SMFZ'),
	VALE="""1.0*SN/abs(SN+1e-9)*(abs(SN)+abs(SMFY)+abs(SMFZ))""",
);

ftau = FORMULE(
	NOM_PARA=('SMT','SVY','SVZ'),
	VALE="""abs(SVY)+abs(SVZ)""",
);

fessai = FORMULE(
	NOM_PARA=('X1','X2'),
	VALE="""abs(X1)+abs(X2)""",
);

stat=CALC_CHAMP(
    reuse =stat,
    RESULTAT=stat, 
    CHAM_UTIL=_F(
		NOM_CHAM='SIPO_ELNO',
		FORMULE=(fsig,ftau),
		NUME_CHAM_RESU=2,
	),
	INFO=2,
);

# a different CALC_CHAMP
stat=CALC_CHAMP(
    reuse =stat,
    RESULTAT=stat, 
    CHAM_UTIL=_F(
		NOM_CHAM='UT02_ELNO',
		FORMULE=(fessai),
		NUME_CHAM_RESU=3,
	),
	INFO=2,
);

jean pierre aubry


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

Offline

#3 2022-01-19 15:36:16

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

Re: [SOLVED] Use a CHAM_UTIL to create another CHAM_UTIL

Hello Jean Pierre.

I see, the problem was the RESULTAT variable.

Thank you for your help, it is working now.

Offline