Mapping boundary conditions

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
fabioretti
Posts: 8
Joined: Fri Apr 13, 2012 2:05 pm

Mapping boundary conditions

Post by fabioretti »

Hi,

I need to define a non-uniform normal velocity distribution over a rectangular inlet boundary, using data from an external ASCII file (3 columns, for x, y and w resp.)
The (x,y) points for which the velocity is available do not coincide with any mesh points.

The question is how to map the available data onto the boundary by some kind of interpolation.

As far as I understand, one has to work with cs_user_boundary_condition. That's fine, but I cannot figure out an efficient way to read the data in and to process it. I'm trying not to have to code interpolating functions (which I'll finally do, though, if unavoidable).

I might even do the interpolation stuff "outside" (e.g. by some python) and thus get a BC set conformal to the mesh boundary, but still I wouldn't know how to import it.

Thanks to anyone for any hint.
Regards,
Fabio
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Mapping boundary conditions

Post by Yvan Fournier »

Hello,

A colleague recently wrote an interpolation package for similar situations, which I will be merging into the main code (at least as advanced examples), but I have not had the time to to this yet (I was hoping to do this next summer).

I could post this as a "raw" example, but I need to take a look at the code first, to see how easy or difficult it is to use this... I'll keep you informed within a few days if this seems easy or not...

In any case, cs_user_boundary_conditions.f90 is the place to do this. Simply, with a detailed example, you have less wheels to reinvent....

Best regards,

Yvan
fabioretti
Posts: 8
Joined: Fri Apr 13, 2012 2:05 pm

Re: Mapping boundary conditions

Post by fabioretti »

Hi Yvan,

Thanks a lot, that is exactly what I was hoping. And reinventing too many wheels is exactly what I would like to avoid!
I'll be looking forward to receiving your raw example. Thanks in advance for that.

Best wishes
fabio
fabioretti
Posts: 8
Joined: Fri Apr 13, 2012 2:05 pm

Re: Mapping boundary conditions

Post by fabioretti »

Dear Yvan,

You certainly remember and probably have been too busy. Just in case you don't, I remind you about the "example" that you said you would provide. That'd help me a lot.

Many thanks!
Fabio
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Mapping boundary conditions

Post by Yvan Fournier »

Hello Fabio,

Not forgotten, but been very busy with other parts of the code. I'll try to check/format that code within a week...

Best regards,

Yvan
fabioretti
Posts: 8
Joined: Fri Apr 13, 2012 2:05 pm

Re: Mapping boundary conditions

Post by fabioretti »

Thank you Yvan, I appreciate.
Best
Fabio
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Mapping boundary conditions

Post by Yvan Fournier »

Hello,

I only had time to take a very short look at the code which was provided to by by Romain.

I post it here (it includes an example data file), hoping that this will be useful (the model is quite complete, allowing cubic splines instead of linear interpolation, but you'll need to check the example and function arguments to see how/when to use this.

Any feedback is appreciated (it will help me make the documentation better). Feedback in the form of improvements or text which could become part of the documentation is even better. And questions are less fun for me to answer (I'm happy answering questions, but have a bit too much at the same time these days), but they also help make a better documentation...

Regards,

Yvan
Attachments
INTERPOL.tgz
(11.16 KiB) Downloaded 335 times
fabioretti
Posts: 8
Joined: Fri Apr 13, 2012 2:05 pm

Re: Mapping boundary conditions

Post by fabioretti »

Hi Yvan

Thank you very much for the example. I'll go through it and certainly get back to you with a feedback, if I manage to get the thing working!

Best wishes
Fabio
fabioretti
Posts: 8
Joined: Fri Apr 13, 2012 2:05 pm

Re: Mapping boundary conditions

Post by fabioretti »

Hi Yvan,

Just started going through it...
I suppose a header file's missing (spline.h).
Can you provide it, please?

Thanks. Regards,
fabio
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Mapping boundary conditions

Post by Yvan Fournier »

Hello,

I'll need to ask the original developer, but you can try commenting the line with "#include "splines.h"", in which case you'll get compiler warnings about missing prototypes, but possibly no other error (i.e. no missing structure, macro, or enum definitions).

I'll check on my side, and keep you informed (if the suggestion above works, it means I have enough info in splines.c to rebuild splines.h).

Regards,

Yvan
Post Reply