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

You are not logged in.

#1 2018-03-12 03:56:02

youdestock
Member
Registered: 2018-03-11
Posts: 10

[SOLVED] Problem when reading a .med file created by Saturne

Hey there,
I'm trying to reading a .med file created by Saturne, I want to read the "TempC (Boundary)" from the "Fluid_result.med" file, and project it on the boundary of the "solid_mesh.med" file for further calculation, here's my code :

MAFLUIDE = LIRE_MAILLAGE(FORMAT='MED', NOM_MED='Fluid domain', UNITE=20)

MASOLIDE = LIRE_MAILLAGE(FORMAT='MED', UNITE=2)

MOFLUIDE = AFFE_MODELE(
    AFFE=_F(MODELISATION=('3D', ), PHENOMENE='THERMIQUE', TOUT='OUI'),
    INFO=1,
    MAILLAGE=MAFLUIDE
)

MOSOLIDE = AFFE_MODELE(
    AFFE=_F(MODELISATION=('3D', ), PHENOMENE='THERMIQUE', TOUT='OUI'),
    MAILLAGE=MASOLIDE
)

mou_mat = DEFI_MATERIAU(
    ELAS=_F(ALPHA=1.2e-05, E=2e+11, NU=0.3, RHO=7870.0),
    THER=_F(LAMBDA=60.0, RHO_CP=400)
)

MATER = AFFE_MATERIAU(
    AFFE=_F(GROUP_MA=('vol_tube', 'vol_mould'), MATER=(mou_mat, )),
    MAILLAGE=MASOLIDE
)

L_INST = DEFI_LIST_REEL(DEBUT=1.0, INTERVALLE=_F(JUSQU_A=100.0, NOMBRE=100))

lir_RE = LIRE_RESU(
    FORMAT='MED',
    FORMAT_MED=_F(NOM_CHAM='PRES', NOM_CHAM_MED='TempC (Boundary)'),
    INFO=2,
    MODELE=MOFLUIDE,
    PROL_ZERO='OUI',
    TOUT_ORDRE='OUI',
    TYPE_RESU='EVOL_CHAR',
    UNITE=81
)

RES_PROJ = PROJ_CHAMP(
    METHODE='COLLOCATION',
    MODELE_1=MOFLUIDE,
    MODELE_2=MOSOLIDE,
    RESULTAT=lir_RE,
    TOUT_ORDRE='OUI',
    VIS_A_VIS=_F(GROUP_MA_1=('face_group_1', ), GROUP_MA_2=('face_group_1', ))
)

load = AFFE_CHAR_THER(EVOL_CHAR=RES_PROJ, MODELE=MOSOLIDE)

resther = THER_NON_LINE(
    CHAM_MATER=MATER,
    ETAT_INIT=_F(INST=0.0, VALE=21.0),
    EXCIT=_F(CHARGE=load),
    INCREMENT=_F(LIST_INST=L_INST),
    MODELE=MOSOLIDE
)

FIN()

Unfortunately, it doesn't work. Always a problem when reading the result from the MED file.
Could anyone help me ?
The Fluid_result.med and the solid_mesh.med will be attached blow.

Offline

#2 2018-03-12 04:06:56

youdestock
Member
Registered: 2018-03-11
Posts: 10

Re: [SOLVED] Problem when reading a .med file created by Saturne

Med File - part1


Attachments:
Mesh.part1.rar, Size: 1.8 MiB, Downloads: 23

Offline

#3 2018-03-12 04:08:41

youdestock
Member
Registered: 2018-03-11
Posts: 10

Re: [SOLVED] Problem when reading a .med file created by Saturne

Med File - part2


Attachments:
Mesh.part2.rar, Size: 1.8 MiB, Downloads: 18

Offline

#4 2018-03-12 04:10:43

youdestock
Member
Registered: 2018-03-11
Posts: 10

Re: [SOLVED] Problem when reading a .med file created by Saturne

Med File - part3


Attachments:
Mesh.part3.rar, Size: 1.76 MiB, Downloads: 21

Offline

#5 2018-03-13 13:42:54

Thomas DE SOZA
Guru
From: EDF
Registered: 2007-11-23
Posts: 3,053

Re: [SOLVED] Problem when reading a .med file created by Saturne

Hello,

The solid mesh MED file is OK.

The fluid results MED file has a problem or at least contains unrecognised outputs for the MED format.

Attempt at converting the file to MED 3.0.8 version

[NS=dsp0780510:2810]$ ConvertMEDFileTo30.py Fluid_results.med 
Traceback (most recent call last):
  File "/opt/salome-meca/INTEGR/V8_INTEGR/tools/Medcoupling-V8_4_0/bin/ConvertMEDFileTo30.py", line 47, in <module>
    ConvertTo30(nameOfMEDFile)
  File "/opt/salome-meca/INTEGR/V8_INTEGR/tools/Medcoupling-V8_4_0/bin/ConvertMEDFileTo30.py", line 33, in ConvertTo30
    mfd=ml.MEDFileData(nameOfMEDFile)
  File "/opt/salome-meca/INTEGR/V8_INTEGR/tools/Medcoupling-V8_4_0/lib/python2.7/site-packages/MEDLoader.py", line 28949, in __init__
    this = _MEDLoader.new_MEDFileData(*args)
MEDLoader.InterpKernelException: constructor MEDFileFields(fileName) : file 'Fluid_results.med' at pos #2 field has name 'boundary zone id' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !

Attempt at opening the file in the MED module of Salome-Meca

>>> import pvsimple as pvs
>>> 
>>> import medcalc
>>> medcalc.medconsole.setConsoleGlobals(globals())
>>> import MEDCALC
>>> 
>>> from medcalc.medconsole import saveWorkspace, cleanWorkspace
>>> from medcalc.medconsole import putInWorkspace, removeFromWorkspace
>>> from medcalc.medconsole import accessField
>>> from medcalc.medconsole import getEnvironment, ls, la
>>> 
>>> source_id = medcalc.LoadDataSource('/home/E50954/Fluid_results.med')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/opt/salome-meca/INTEGR/appli_V8_INTEGR/lib/python2.7/site-packages/salome/medcalc/medio.py", line 24, in LoadDataSource
    handler = dataManager.loadDatasource(filename)
  File "/opt/salome-meca/INTEGR/appli_V8_INTEGR/lib/python2.7/site-packages/salome/MEDDataManager_idl.py", line 212, in loadDatasource
    return _omnipy.invoke(self, "loadDatasource", _0_MEDCALC.MEDDataManager._d_loadDatasource, args)
omniORB.CORBA.UNKNOWN: CORBA.UNKNOWN(omniORB.UNKNOWN_UserException, CORBA.COMPLETED_MAYBE)
>>> source_id
Traceback (most recent call last):
  File "<input>", line 1, in <module>
NameError: name 'source_id' is not defined
>>> presentation_id = medcalc.MakeMeshView(medcalc.GetFirstMeshFromDataSource(source_id), viewMode=MEDCALC.VIEW_MODE_REPLACE)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
NameError: name 'source_id' is not defined
>>> presentation_id
Traceback (most recent call last):
  File "<input>", line 1, in <module>
NameError: name 'presentation_id' is not defined
>>> 

You should review the output and maybe remove the field name "boundary zone id".

TdS

Offline

#6 2018-03-13 16:25:05

youdestock
Member
Registered: 2018-03-11
Posts: 10

Re: [SOLVED] Problem when reading a .med file created by Saturne

Thanks a lot for your reply Thomas,

I checked my fluid mesh, and I generate a new one which has been attached below.(time step=40, output result every 5 steps)
I check the new Fluid mesh file with Salome-meca, it seems correct.
But, Aster-study still cannot read it.
Is there's something wrong with my Code? if so, will you show me the correct LIRE_RESU code and maybe PROJ_CHAMP?

P.S. I have no idea of how to delete "boundary zone id", I think it is automatically created by code_Saturne.

Cordialement,


Attachments:
re_Fluid_mesh.med, Size: 914.13 KiB, Downloads: 18

Offline

#7 2018-03-14 13:48:35

Thomas DE SOZA
Guru
From: EDF
Registered: 2007-11-23
Posts: 3,053

Re: [SOLVED] Problem when reading a .med file created by Saturne

Hello,

The new fluid mesh is now correct in the sense that it can be read by the MED module of Salome-Meca (this was not the case before).

Regarding the error you get when launching the calculation, there are several things you need to fix:

  • the fluid mesh file on which you will define a "fluid model" in code_aster should be the boundary not the fluid domain, as it is the only part to be in contact with the solid domain

  • the LIRE_RESU part is incomplete as the component of the 'TempC (boundary)' field ("scalar") is not what is expected by code_aster ('TEMP'). You should use NOM_CMP and NOM_CMP_MED in LIRE_RESU/FORMAT_MED

  • importing an external field through LIRE_RESU with the EVOL_CHAR type is limited to a few examples detailed in the manual of LIRE_RESU [U7.02.01] : for temperature, you can only import T_EXT (with component TEMP)  and COEF_H (with component H) which enable the use of an exchange boundary condition in thermics

You should also review both of the following testcases : ZZZZ137B for LIRE_RESU imports of temperature fields and ZZZZ215C for LIRE_RESU imports of pressure fields from Code_Saturne.

Good luck,

TdS

Offline

#8 2018-03-15 18:56:18

youdestock
Member
Registered: 2018-03-11
Posts: 10

Re: [SOLVED] Problem when reading a .med file created by Saturne

Hello Thomas,
Thank you for your advices.
I made several changes for my code:

1. the "bonudary" part is imported:

MAFLUIDE = LIRE_MAILLAGE(
  FORMAT='MED', 
  NOM_MED='Boundary', 
  UNITE=2
)

2. change the NOM_CHAM equals to 'T_EXT' in LIRE_RESU. But still very confuse after reading the manual LIRE_RESU [U7.02.01].
In your second advice, you suggest me to use NOM_CMP and NOM_CMP_MED in LIRE_RESU/FORMAT_MED and you also said that the component should be 'TEMP' for aster_study. so,

  • How to display the component in the med file? if it is not TEMP, How am I suppose to change it?

  • Not very clear about the definition of Opérandes NOM_CMP/NOM_CMP_MED/NOM_CHAM_MED (NOM_CHAM is clear, it equals to 'T_EXT' when reading temperature). Page 9 du manuel LIRE_RESU [U7.02.01], "T_EXT: Carte de température extérieure, composante TEMP", si j'ai bien compris, c'est-a-dire,
    NOM_CHAM='T_EXT',
    NOM_CHAM_MED='TempC (Boundary)' ____c'est le nom du champ qu'on veut lire dans le fichier .med
    NOM_CMP=('TEMP', )____c'est le composante 'TEMP'
    mais c'est quoi le 'NOM_CMP_MED', pouvez-vous m'expliquer le 'NOM_CMP_MED'?

Si j'ecrit le code comme ça:

lir_RE = LIRE_RESU(
  FORMAT='MED', 
  FORMAT_MED=_F(
    NOM_CHAM='T_EXT', 
    NOM_CHAM_MED='TempC (Boundary)', 
    NOM_CMP=('TEMP', ), 
    NOM_CMP_MED=('TempC (Boundary)', )
  ), 
  MODELE=MOFLUIDE, 
  PROL_ZERO='OUI', 
  TOUT_ORDRE='OUI', 
  TYPE_RESU='EVOL_CHAR', 
  UNITE=3
)

Il y a une erreur

JDC.py : ERREUR A L'EXECUTION - INTERRUPTION
>> JDC.py : DEBUT RAPPORT
CR d'execution de JDC en MIXTE
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   ! <S> Exception utilisateur levee mais pas interceptee. !
   ! Les bases sont fermees.                               !
   ! Type de l'exception : error                           !
   !                                                       !
   !   -> Composante inconnue pour la grandeur.            !
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
fin CR d'execution de JDC en MIXTE

>> JDC.py : FIN RAPPORT
EXECUTION_CODE_ASTER_EXIT_12073=1

 <I>_EXIT_CODE = 1

si je supprime NOM_CMP et NOM_CMP_MED (comme l'example ZZZZ137B), erreur suivant va afficher:

!----------------------------------------------------------------!
   ! <A> <POSTRELE_56>                                              !
   !                                                                !
   !  la composante Scalar n'est pas une composante de TEMP_R       !
   !                                                                !
   !                                                                !
   ! Ceci est une alarme. Si vous ne comprenez pas le sens de cette !
   ! alarme, vous pouvez obtenir des résultats inattendus !         !
   !----------------------------------------------------------------!

Last edited by youdestock (2018-03-15 18:58:23)

Offline

#9 2018-03-15 22:56:42

Thomas DE SOZA
Guru
From: EDF
Registered: 2007-11-23
Posts: 3,053

Re: [SOLVED] Problem when reading a .med file created by Saturne

Hello,

The result file in MED you retrieved from Code_Saturne has the following characteristics:

  • it contains a field name "TempC (Boundary)" ==> so NOM_CHAM_MED='TempC (Boundary)'

  • this field contains only one component named "Scalar" ==> so NOM_CMP_MED='Scalar'

You want to use that field in code_aster to input a temperature load:

  • the imposed field name for the EVOL_CHAR type of load is "T_EXT"  ==> so NOM_CHAM='T_EXT'

  • the imposed component name for the T_EXT field in code_aster est "TEMP" ==> so NOM_CMP='TEMP'

TdS

Offline

#10 2018-03-22 04:08:13

youdestock
Member
Registered: 2018-03-11
Posts: 10

Re: [SOLVED] Problem when reading a .med file created by Saturne

Sorry for the delay, I'm quite busy these days. thank you for the reply.
with your useful and professional instruction I manage to read the .med file.
Best reagrds,

Last edited by youdestock (2018-03-22 18:14:16)


Attachments:
re_Fluid_mesh.med, Size: 914.13 KiB, Downloads: 17

Offline

Board footer