Output Variables on Boundary

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
mbgnfsr2

Output Variables on Boundary

Post by mbgnfsr2 »

I have to visualize the velocity on the boundary since I'm playing with the inlet boundary condition.
Opposite to the old version 2.0 velocity (and some other variables) are not longer available at the boundary faces. Only geometrical information are exported also at the boundaries.

In try to force the output of the boundary in cs_user_postprocess with and without the default output of variables.

What ever I trying i get the following error

Code: Select all

Call stack:
   SIGSEGV signal (forbidden memory area access) intercepted!
   1: 0x7f3f8175de10 <+0x34e10>                       (libc.so.6)
   2: 0x7f3f847be2be <+0x1a92be>                      (libsaturne.so.0)
   3: 0x7f3f847c1dad <cs_post_define_surface_mesh+0x44> (libsaturne.so.0)
   4: 0x431371     <cs_user_postprocess_meshes+0x4e> (cs_solver)
   5: 0x7f3f846752e7 <cs_run+0x6db>                   (libsaturne.so.0)
   6: 0x7f3f84675c37 <main+0x15d>                     (libsaturne.so.0)
   7: 0x7f3f8174a23d <__libc_start_main+0xed>         (libc.so.6)
   8: 0x412309     <>                               (cs_solver)
End of stack
The code that i have used in cs_user_postprocess.c is the following
Writer definition

Code: Select all

output_at_end = true;
        ntchr =  2;
        frchr = -1.0;
  
        cs_post_define_writer(1,                            /* writer_id */
                        "inlet",                       /* writer name */
                        "postprocessing_inlet",             /* directory name */
                        "EnSight Gold",               /* format name */
                        "text, discard_polygons, discard_polyhedra",
                        time_dep,
                        output_at_end,
                        ntchr,
                        frchr);
Creation of the part

Code: Select all

int n_writers = 1;
    const int writer_ids = {1};

    cs_post_define_surface_mesh(1,          /* mesh_id of main boundary mesh */
                                "Inlet",  /* mesh name */
                                NULL,        /* interior face selection criteria */
                                "all[]",     /* boundary face selection criteria */
                                false,        /* add_groups */
                                false,        /* automatic variables output */
                                n_writers,
                                writer_ids);
In this example i try without adding any group and without automatic variable, but after i would like to try with this two options in order to see what i have got by default at my boundary.

I test this with CS V_3.0.0 R4823

Is there anyone that experience a similar problem and manage to find a solution.
Thanks very much

Stefano
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Output Variables on Boundary

Post by Yvan Fournier »

Hello Stefano,

I did not notice anything wrong in your setup. The "text" option is rarely used, so you might try NULL or "binary". You may also try to define an identical writer using the GUI.

If all of this fails, it would help if you could run a debug build of the code, so as to tell us at what line the code crashes (using "addr2line" combined with the stack trace).

Finally, the options from V2.0 have not been removed, only "hidden" (as the output is the "non-reconstructed" boundary condition, or something similar, whose interpretation may be tricky); To activate those outputs, check the cs_user_field_parameters subroutine in cs_user_parameters.f90.

Cheers,

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

Re: Output Variables on Boundary

Post by Yvan Fournier »

Hello,

I have found your bug (and it is in your user subroutine, not in the code 8-) ); you define

Code: Select all

int n_writers = 1;
const int writer_ids = {1};
But writer_ids must be an array (as a mesh may be associated to multiple writers), so the declaration should be:

Code: Select all

int n_writers = 1;
const int writer_ids[] = {1};
This fixes the problem.

Cheers

Yvan
Post Reply