coupling with code_aster deformation issues

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Paul Brss
Posts: 32
Joined: Mon Dec 04, 2017 3:00 pm

Re: coupling with code_aster deformation issues

Post by Paul Brss »

Hello Yvan and Luciano,

I was struggling with my case until this morning. I made the change as recommended by Luciano (thanks by the way), and it seems to work now ! I need to make some experimental comparisons and I'll keep you informed.

Paul
Yvan Fournier
Posts: 4226
Joined: Mon Feb 20, 2012 3:25 pm

Re: coupling with code_aster deformation issues

Post by Yvan Fournier »

Hello,

Looking at the sources, asddlf is set either by a user subroutine or by the GUI, in uiaste from the src/gui/cs_gui_mobile_mesh.c file.

It might be interesting to print the values there to see what is going on (because those values do not otherwise seem to be modified, unless you are also modifying them in a user subroutine). You can simply copy that file to the SRC directory of your case and editi it for testing (not recommended general practice for development, but should work for debugging here).

Best regards,

Yvan
Luciano Garelli
Posts: 284
Joined: Fri Dec 04, 2015 1:42 pm

Re: coupling with code_aster deformation issues

Post by Luciano Garelli »

Hello Yvan,
It might be interesting to print the values there to see what is going on (because those values do not otherwise seem to be modified, unless you are also modifying them in a user subroutine). You can simply copy that file to the SRC directory of your case and editi it for testing (not recommended general practice for development, but should work for debugging here)
This is what I did to find the error. I copy the cs_ast_coupling.c, cs_gui_mobile_mesh.c, strdep.f90 and start to print values. If I print the values after the set of the asddlf in cs_gui_mobile_mesh.c

Code: Select all

/* Get DDLX, DDLY and DDLZ values */
      asddlf[istruct * 3 + 0] = _get_external_coupling_dof(label, "DDLX") ? 0 : 1;
      asddlf[istruct * 3 + 1] = _get_external_coupling_dof(label, "DDLY") ? 0 : 1;
      asddlf[istruct * 3 + 2] = _get_external_coupling_dof(label, "DDLZ") ? 0 : 1;
      
      bft_printf("istruct %d, ASDDLF_X %d, ASDDLF_Y %d, ASDDLF_Z %d \n",istruct, asddlf[istruct * 3 + 0], asddlf[istruct * 3 + 1], asddlf[istruct * 3 + 2]);
I get this

Code: Select all

istruct 0, ASDDLF_X -1878870816, ASDDLF_Y 6370896, ASDDLF_Z -1 
And if print the asddlf in the strdep.f90 where it is used

Code: Select all

 do ii = 1, 3
       forast(ii,indast) = asddlf(ii,-istr)*forbr(ii,ifac)
    enddo
I get

Code: Select all

DDLX=    0.00000E+00, DDLY=      1.0727E+09, DDLZ=    0.00000E+00
I was cheking that the array is created as a bi-dimensional array in fortran in alaste.f90 (integer, save :: asddlf(3,nastmx), asddlc(3,nastmx)), then is set in a C function (asddlf[istruct * 3 + 0] = _get_external_coupling_dof(label, "DDLX") ? 0 : 1;) ans finally used in a fortran subrutine. May be the problem can be here, because as you mention this array is not overwritted

Regards,

Luciano
Yvan Fournier
Posts: 4226
Joined: Mon Feb 20, 2012 3:25 pm

Re: coupling with code_aster deformation issues

Post by Yvan Fournier »

Hello Luciano,

Looks like asddlf is declared as an integer in Fortran and a double in C... That is probably the error (because the interleaving seems ok).

Could you try swiching it to int in C ? Both in the .c and .h files...

Best regards,

Yvan
Luciano Garelli
Posts: 284
Joined: Fri Dec 04, 2015 1:42 pm

Re: coupling with code_aster deformation issues

Post by Luciano Garelli »

Hello Yvan,

Yes...you are right. I change the declaration in the .c and .h files to an integer and now the output is OK

Code: Select all

istruct 0, ASDDLF_X 1, ASDDLF_Y 1, ASDDLF_Z 1 
Thanks for your help!

Regards,

Luciano
Luciano Garelli
Posts: 284
Joined: Fri Dec 04, 2015 1:42 pm

Re: coupling with code_aster deformation issues

Post by Luciano Garelli »

Hello Yvan and Paul,

In a previous post I mention that the restart dosen't work given an error about differences in the simulation time. The problem was that I don't update the start_time in the coupling_parameters.py for the FSI_coupler.

Now I can restart the simulation from a previous run.

Regards,

Luciano
Yvan Fournier
Posts: 4226
Joined: Mon Feb 20, 2012 3:25 pm

Re: coupling with code_aster deformation issues

Post by Yvan Fournier »

Hello Luciano,

Thanks for the update. I'll push to integer/double fix into Git tomorrow, so the next releases (5.2.1, 5.1.5, and 5.0.9) will have the fix.

Good that this coupling finally seems to be useful...

Best regards,

Yvan
Paul Brss
Posts: 32
Joined: Mon Dec 04, 2017 3:00 pm

Re: coupling with code_aster deformation issues

Post by Paul Brss »

Hi Luciano and Yvan,

I'm trying to use the restart option (with aster coupling) and it causes some trouble with the ALE module. To be clear, the restart works but does not take into account the mesh viscosity set in the previous simulation by setting it equals to 1 in the whole domain.

Did you face this problem ?


Yvan, can I use a function to modify the mesh viscosity in the domain, as in the GUI ?


Regards,

Paul
Luciano Garelli
Posts: 284
Joined: Fri Dec 04, 2015 1:42 pm

Re: coupling with code_aster deformation issues

Post by Luciano Garelli »

Hello Paul,

Yes, few days ago I restart a calculation and I faced the same problem...the mesh viscosity was not changed with the new distribution, but I don't know if it is a bug or you can't change the mesh viscosity due to matrix assembling, solver, etc. in a restart.

I don't tested if the same problem occurs solving only a fluid dynamic case.

Regards,

Luciano
Yvan Fournier
Posts: 4226
Joined: Mon Feb 20, 2012 3:25 pm

Re: coupling with code_aster deformation issues

Post by Yvan Fournier »

Hello,

As I did not run your case, I am not sure: did you set the mesh viscosity using a user subroutine or simply the GUI ?

In any case, it should be handled, but I suspect the setting is skipped by the restart (it this is what I understand).
Do you have warnings about values not read in the restart file ? Especially regarding ALE ? The values should normally be read.

In src/base/lecamx.f90 the tests on "iortvm" seem to indicate the viscosity is read only for anisotropic cases, which seems strange... So you might want to change the test (line 834 on master branch) from:

Code: Select all

if (iortvm.eq.1) then
    if (jortvm.ne.1) then
to:

Code: Select all

  if (.true.) then
    if (jortvm.ne.1) then

Also, if the previous case was not using ALE, this will not be enough. In src/base/phyvar.f90 (line 654 on master branch),

Code: Select all

if (iale.eq.1.and.ntcabs.eq.0) then
should be replaced by:

Code: Select all

if (iale.eq.1.and.ntcabs.eq.ntpabs) then
or even

Code: Select all

if (iale.eq.1.and.ntcabs.le.ntpabs-1) then
Better yet, the corresponding section should be in iniva0 if we want it to be always initialized (but overwriten by the restart), or inivar (if we want the current values to have priority). I prefer the second option, in which case it is probably not even useful to have this in the restart file, except for really complex user cases.

I'll let you test changing these files...

Best regards,

Yvan
Post Reply