Page 2 of 3

Re: Zero gradient at certain faces

Posted: Tue Jul 18, 2017 2:05 pm
by rodion
Thank you for your answer, Yvan.

I have such errors with CS 5.0 and CS 4.3 on Windows in case of electric arc simulation. I have provided the full list of such errors here:
http://code-saturne.org/forum/viewtopic.php?f=2&t=2137
Without electric arc simulation CS 4.3 doesn't give such errors during the compiling process.

Okay, it is clear now. Thank you very much for your assistance.

Best regards,
Rodion

Re: Zero gradient at certain faces

Posted: Mon Sep 11, 2017 3:10 pm
by rodion
Hello everyone,

I have tried the following code to separate cathode and anode:

Code: Select all

void cs_user_internal_coupling_add_volumes(cs_mesh_t  *mesh)
{
  cs_internal_coupling_add_volume(mesh, "anode"); /* Solid volume criterion */
  cs_internal_coupling_add_volume(mesh, "domaine_cathode"); /* Solid volume criterion */
}
And the following code to couple electric potential:

Code: Select all

void cs_user_internal_coupling(void)
{
  int f_id = cs_field_id_by_name("elec_pot_r");
  cs_internal_coupling_add_entity(f_id);  /* Field to be coupled */
}
But unfortunately, coupling of electric potential doesn't work. For this reason electric potential difference goes to infinity and consequently enthalpy of cathode goes to infinity too.
Does anybody know, how I can make electric potential coupling to work?

By the way, as far as I can see, the function cs_user_internal_coupling_add_volumes creates additional boundaries inside the domain, so I've assigned a zone number to all new boundary faces by the following code:

Code: Select all

do ifac=1,nfabor
  if (izfppp(ifac).eq.0) then
    izone = 8
    izfppp(ifac) = izone
    itypfb(ifac) = iparoi
  end if
end do
Is it correct to do like this?

Best regards,
Rodion

Re: Zero gradient at certain faces

Posted: Mon Sep 11, 2017 5:08 pm
by Yvan Fournier
Hello,

Your coding seems correct at first glance. Though for the internal coupling definition, you might try just

Code: Select all

void cs_user_internal_coupling_add_volumes(cs_mesh_t  *mesh)
{
  cs_internal_coupling_add_volume(mesh, "anode or domaine_cathode");
}
Instead of:

Code: Select all

void cs_user_internal_coupling_add_volumes(cs_mesh_t  *mesh)
{
  cs_internal_coupling_add_volume(mesh, "anode"); /* Solid volume criterion */
  cs_internal_coupling_add_volume(mesh, "domaine_cathode"); /* Solid volume criterion */
}
So you have a single instead of a double coupling, which might be a bit simpler.

The zone number is optional, and when the boundary is inserted automatically, and automatic group name is defined (you can check it looking at the "listing").

Also, what linear solver do you use for electric potential ?

Finally, I am not sure, but I seem recalling for electric arcs, you may have both a real and imaginary components. If this is the case, you may need to couple both.

Best regards,

Yvan

Re: Zero gradient at certain faces

Posted: Mon Sep 11, 2017 10:19 pm
by rodion
Thank you for your answer, Yvan.

Yes, I can see these boundaries names "auto:internal_coupling_0" and "auto:internal_coupling_1". Should I impose any additional boundary conditions for it?

Sorry, what do you mean by "linear solver"? If it is "Gradient calculation method" then I use that one which is configured by default — "Iterative handling of non-orthogonalities".

I don't know about imaginary potential, but in the list of fields I can see only elec_pot_r and vec_potential. I have tried to couple vector potential too by the following code:

Code: Select all

  f_id = cs_field_id_by_name("vec_potential");
  cs_internal_coupling_add_entity(f_id);
But I have got the following error:

SIGSEGV signal (forbidden memory area access) intercepted!

Best regards,
Rodion

Re: Zero gradient at certain faces

Posted: Tue Sep 12, 2017 11:45 am
by Yvan Fournier
Hello,

The internal coupling is not yet available for vector variables, so this probably explains the "SIGSEGV" crash (though we should have a correct check and error message).

There might not be an imaginary potential for you model variant.

By linear solver, I mean the solver choice in "equation parameters".

Regards,

Yvan

Re: Zero gradient at certain faces

Posted: Tue Sep 12, 2017 2:15 pm
by rodion
Thank you for your answer, Yvan.

It means that I cannot use this coupling for electric arcs simulation?
Or maybe I can couple components of vector potential separately?

I think that in my case real electric potential is derived from vector potential and I don't need imaginary potential. Is it correct?

I have not changed anything in the tab called "Solver", so it is "Automatic". Should I change it?

Best regards,
Rodion

Re: Zero gradient at certain faces

Posted: Tue Sep 12, 2017 3:07 pm
by Yvan Fournier
Hello,

The default solver (Jacobi) may not converge too well with purely diffusive zones. In case of problems, you should have warnings in the "listing" file.

And yes, internal coupling may still be limited here if you also need to couple the vector potential... Otherwise, we should get it working. Since electric arcs are pretty sensitive from a numerical standpoint, you may need extra precautions to avoid negative values in some areas, or code your physical properties in such a way that you never have negative values even if the input is slightly "out of expected range".

An alternative coupling would be the weaker "boundary conditions coupling" using 2 separate instances of the code (will be possible in a single instance in version 5.1) but I am not sure how efficient that would be, and it is really very little documented...

Regards,

Yvan

Re: Zero gradient at certain faces

Posted: Tue Sep 12, 2017 4:01 pm
by rodion
Thank you for your answer, Yvan.

Do you know if it is planned to develop coupling of vector fields?
Or maybe it is possible to replace vector field of vector potential with three scalar fields of vector potential components?

I need to have both electrodes and fluid at the same domain to estimate magnetic field and Laplace force more accurately.

Best regards,
Rodion

Re: Zero gradient at certain faces

Posted: Fri Sep 15, 2017 2:02 pm
by Luciano Garelli
Hello,

I was checking the developing version (trunk) http://code-saturne.org/viewvc/saturne/ of CS and in the Revision 10448 was added internal coupling to vector quantities.
It is not the production version of CS and could be potentially unstable, but you can try if it works in your case.

Regards,

Luciano

Re: Zero gradient at certain faces

Posted: Sun Oct 01, 2017 9:57 pm
by rodion
Thank you for your answer,

I have checked the version 5.0.4 of Code_Saturne. As far as I realize it is the revision 10531. Which is more recent than 10448, if I got it right.
I have tried to make coupling of vector potential, but I still get the following error:
SIGSEGV signal (forbidden memory area access) intercepted!

Call stack:
1: 0x7f0f71685b72 <cs_internal_coupling_spmv_contribution+0x152> (libsaturne.so.5)
2: 0x7f0f7183a1ba <cs_matrix_vector_multiply+0xda> (libsaturne.so.5)
3: 0x7f0f7184646e <cs_matrix_vector_native_multiply+0x15e> (libsaturne.so.5)
4: 0x7f0f715f259d <cs_equation_iterative_solve_vector+0x6ad> (libsaturne.so.5)
5: 0x7f0f71be186a <__cs_c_bindings_MOD_coditv+0x2f5> (libsaturne.so.5)
6: 0x7f0f715bb9f5 <covofv_+0x11cd> (libsaturne.so.5)
7: 0x7f0f716e1e99 <scalai_+0x996> (libsaturne.so.5)
8: 0x7f0f716edcae <tridim_+0x5797> (libsaturne.so.5)
9: 0x7f0f7158a451 <caltri_+0x20e2> (libsaturne.so.5)
10: 0x7f0f7155bbad <cs_run+0x57d> (libsaturne.so.5)
11: 0x7f0f7155b4e5 <main+0x125> (libsaturne.so.5)
12: 0x7f0f708e63f1 <__libc_start_main+0xf1> (libc.so.6)
13: 0x55dccf8deb5a <_start+0x2a> (cs_solver)
End of stack
It is similar on both Windows 7 x64 and Linux (Lubuntu 17.04).

Am I doing something wrong?

Best regards,
Rodion