Error running long pipe with variable density subroutine

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
hyder4
Posts: 22
Joined: Tue Apr 04, 2023 12:06 am

Error running long pipe with variable density subroutine

Post by hyder4 »

Hi,
I was running a simulation of a long pipe to check user subroutine in which I defined density as variable using the ideal gas equation and I got an error as follows.
{
code_saturne_7.1_git/code_saturne-7.1/src/base/cs_field.c:1103: Fatal error.

Fortran pointer of rank 1 requested for values of field "velocity",
which have rank 2.
}

I have attached the subroutines, setup and mesh.
Kind regards,
Hyder.
Attachments
ICM.cgns
(4.88 MiB) Downloaded 38 times
cs_user_physical_properties.f90
(5.75 KiB) Downloaded 41 times
cs_user_parameters.c
(3.34 KiB) Downloaded 44 times
hyder4
Posts: 22
Joined: Tue Apr 04, 2023 12:06 am

Re: Error running long pipe with variable density subroutine

Post by hyder4 »

Setup file.
Attachments
setup.xml
(7.77 KiB) Downloaded 43 times
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Error running long pipe with variable density subroutine

Post by Yvan Fournier »

Hello,

do you have a stack trace so as to know from which functions this was called ? If it is in the user-defined properties, it means some other index might be wrong, since velocity is not mentioned explicitly...

Also, version 7.1 is retired, so I recommend using version 8.0-beta instead, which is being fully tested, and update (bug fixes only) to v8.0 when it is released next June.

Best regards,

Yvan
hyder4
Posts: 22
Joined: Tue Apr 04, 2023 12:06 am

Re: Error running long pipe with variable density subroutine

Post by hyder4 »

do you mean this?
{
all stack:
1: 0x7fc413989bfe <cs_f_field_var_ptr_by_id+0x7e> (libsaturne-7.1.so)
2: 0x7fc4140c2c6c <__field_MOD_field_get_val_s+0x21> (libsaturne-7.1.so)
3: 0x556e5065037d <usphyv_+0x74> (cs_solver)
4: 0x7fc413a7cd9b <phyvar_+0x1c2> (libsaturne-7.1.so)
5: 0x7fc4139059fa <caltri_+0x5bc> (libsaturne-7.1.so)
6: 0x7fc4147f2b81 <main+0x721> (libcs_solver-7.1.so)
7: 0x7fc41365d0b3 <__libc_start_main+0xf3> (libc.so.6)
8: 0x556e5065008e <_start+0x2e> (cs_solver)
End of stack
}
Best regards,
Hyder.
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Error running long pipe with variable density subroutine

Post by Yvan Fournier »

Yes.

This confirms the error occurs in the usphyv code.

Answering from my phone so I can't check in detail right now. Running a debug build could be interesting.

Regards,

Yvan
hyder4
Posts: 22
Joined: Tue Apr 04, 2023 12:06 am

Re: Error running long pipe with variable density subroutine

Post by hyder4 »

Thank you. Please keep me updated.
best,
Hyder.
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Error running long pipe with variable density subroutine

Post by Yvan Fournier »

Hello,

Your usphyv definition is incorrect.

For some reason, you have commented the "dt" part out of the subroutine definition. Since the function is a standard function of the code, you must never do that unless you reinstall the code with the same modification in the reference file and call site. This can be a source of the bug.

So first fix this, than test again.

You might also try moving the "irovar" setting from cs_user_parameters to cs_user_model (called earlier) in the same file.
Also, you need to remove the "#pragma weak" line.

If this is not sufficient, comment the calls to field_get_val_s one by one to see which one is responsible, but in this case I would suspect an install issue...

Best regards,

Yvan
hyder4
Posts: 22
Joined: Tue Apr 04, 2023 12:06 am

Re: Error running long pipe with variable density subroutine

Post by hyder4 »

Hello,
I have done everything you described and also installed sauterne version 7.3.0. it seems the error is coming when I call the temperature using { call field_get_val_s(ivarfl(isca(iscalt)),cvar_scalt)} function in the subroutine.
is there a way to solve this problem?
one of the interesting thing is the same subroutine is working well in closed cavity geometry ( no inlet and outlet)
I have attached the improved subroutines.
Best regards,
Hyder.
Attachments
cs_user_physical_properties.f90
(5.75 KiB) Downloaded 43 times
cs_user_parameters.c
(3.29 KiB) Downloaded 35 times
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Error running long pipe with variable density subroutine

Post by Yvan Fournier »

Hello,

Are you sure the thermal model is activated in rhis case ? If not, that could explain the issue.

Regards,

Yvan
hyder4
Posts: 22
Joined: Tue Apr 04, 2023 12:06 am

Re: Error running long pipe with variable density subroutine

Post by hyder4 »

Hi,
Thanks it solved the problem.

Best,
Hyder.
Post Reply