7.1
general documentation
cs_at_opt_interp.h
Go to the documentation of this file.
1 #ifndef __CS_AT_OPT_INTERP_H__
2 #define __CS_AT_OPT_INTERP_H__
3 
4 /*============================================================================
5  * Optimal Interpolation.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2021 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 #if defined(HAVE_MPI)
31 #include <mpi.h>
32 #endif
33 
34 /*----------------------------------------------------------------------------
35  * Local headers
36  *----------------------------------------------------------------------------*/
37 
38 #include "cs_defs.h"
39 
40 #include "cs_field.h"
41 #include "cs_measures_util.h"
42 
43 /*----------------------------------------------------------------------------*/
44 
46 
47 /*=============================================================================
48  * Macro definitions
49  *============================================================================*/
50 
51 /*============================================================================
52  * Type definitions
53  *============================================================================*/
54 
55 typedef enum {
56 
57  CS_AT_OPT_INTERP_P0, /* Interpolation from cell containing the observation */
58  CS_AT_OPT_INTERP_P1 /* Interpolation from (partial) extended neighbourhood */
59 
61 
62 typedef struct _cs_at_opt_interp_t {
63 
64  const char *name; /* Name */
65  int id; /* Id */
66  int ig_id;
74  cs_real_t ir[2];
76  int nb_times;
84  int steady;
85  int frequency;
87 
89 
90 /*============================================================================
91  * Global variables
92  *============================================================================*/
93 
94 /*=============================================================================
95  * Public function prototypes
96  *============================================================================*/
97 
98 /*----------------------------------------------------------------------------*/
105 /*----------------------------------------------------------------------------*/
106 
108 cs_at_opt_interp_create(const char *name);
109 
110 /*----------------------------------------------------------------------------*/
121 /*----------------------------------------------------------------------------*/
122 
124 cs_at_opt_interp_by_id(int id);
125 
126 /*----------------------------------------------------------------------------*/
137 /*----------------------------------------------------------------------------*/
138 
140 cs_at_opt_interp_by_name(const char *name);
141 
142 /*----------------------------------------------------------------------------*/
146 /*----------------------------------------------------------------------------*/
147 
148 void
150 
151 /*----------------------------------------------------------------------------*/
162 /*----------------------------------------------------------------------------*/
163 
164 void
165 cs_at_opt_interp_read_file(char const filename[50],
166  cs_measures_set_t *ms,
167  cs_at_opt_interp_t *oi,
168  const int f_dim);
169 
170 /*----------------------------------------------------------------------------*/
178 /*----------------------------------------------------------------------------*/
179 
180 int
182 
183 /*----------------------------------------------------------------------------*/
191 /*----------------------------------------------------------------------------*/
192 
193 void
195  cs_measures_set_t *ms);
196 
197 /*----------------------------------------------------------------------------*/
205 /*----------------------------------------------------------------------------*/
206 
207 void
209  cs_at_opt_interp_t *oi,
210  cs_interpol_grid_t *ig);
211 
212 /*----------------------------------------------------------------------------*/
219 /*----------------------------------------------------------------------------*/
220 
221 void
223  cs_at_opt_interp_t *oi);
224 
225 /*----------------------------------------------------------------------------*/
239 /*----------------------------------------------------------------------------*/
240 
241 int *
243  cs_at_opt_interp_t *oi,
244  cs_field_t *f_oia,
245  bool **inverse,
246  int ***ao_idx);
247 
248 /*----------------------------------------------------------------------------*/
260 /*----------------------------------------------------------------------------*/
261 
262 void
264  cs_at_opt_interp_t *oi,
265  cs_field_t *f_oia,
266  int n_active_obs,
267  int *ao_idx,
268  bool inverse,
269  int mc_id);
270 
271 /*----------------------------------------------------------------------------*/
272 
274 
275 #endif /* __CS_AT_OPT_INTERP_H__ */
int frequency
Definition: cs_at_opt_interp.h:85
int cs_at_opt_interp_is_p1_proj_needed(void)
Return 1 if a p1 projection has been enabled for at least one optimal interpolation. This function is used to determine if extended neighborhood is needed.
Definition: cs_at_opt_interp.c:1280
Definition: cs_measures_util.h:72
void cs_at_opt_interp_project_model_covariance(cs_measures_set_t *ms, cs_at_opt_interp_t *oi)
Compute ${H}{B}{{H}}$.
Definition: cs_at_opt_interp.c:1377
cs_lnum_t * model_to_obs_proj_idx
Definition: cs_at_opt_interp.h:71
cs_real_t * time_weights
Definition: cs_at_opt_interp.h:81
Field descriptor.
Definition: cs_field.h:125
Definition: cs_measures_util.h:47
bool obs_cov_is_diag
Definition: cs_at_opt_interp.h:68
void cs_at_opt_interp_compute_analysis(cs_field_t *f, cs_at_opt_interp_t *oi, cs_field_t *f_oia, int n_active_obs, int *ao_idx, bool inverse, int mc_id)
Compute analysis for a given variable.
Definition: cs_at_opt_interp.c:1600
cs_real_t * times
Definition: cs_at_opt_interp.h:78
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
cs_real_t * b_proj
Definition: cs_at_opt_interp.h:73
const char * name
Definition: cs_at_opt_interp.h:64
cs_lnum_t * model_to_obs_proj_c_ids
Definition: cs_at_opt_interp.h:72
void cs_at_opt_interps_destroy(void)
Destroy all defined optimal interpolations.
Definition: cs_at_opt_interp.c:675
cs_at_opt_interp_t * cs_at_opt_interp_create(const char *name)
Create an optimal interpolation descriptor.
Definition: cs_at_opt_interp.c:525
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
int n_log_data
Definition: cs_at_opt_interp.h:83
cs_real_t * times_read
Definition: cs_at_opt_interp.h:79
Definition: cs_at_opt_interp.h:62
void cs_at_opt_interp_obs_operator(cs_measures_set_t *ms, cs_at_opt_interp_t *oi, cs_interpol_grid_t *ig)
Compute observation operator (H).
Definition: cs_at_opt_interp.c:1345
int * measures_idx
Definition: cs_at_opt_interp.h:77
void cs_at_opt_interp_read_file(char const filename[50], cs_measures_set_t *ms, cs_at_opt_interp_t *oi, const int f_dim)
Read an optimal interpolation file for a given variable and fill in the matching measures set and opt...
Definition: cs_at_opt_interp.c:715
int steady
Definition: cs_at_opt_interp.h:84
Definition: cs_at_opt_interp.h:58
cs_at_opt_interp_t * cs_at_opt_interp_by_name(const char *name)
Return a pointer to an optimal interpolation based on its name.
Definition: cs_at_opt_interp.c:655
int id
Definition: cs_at_opt_interp.h:65
int * active_time
Definition: cs_at_opt_interp.h:80
int type_nudging
Definition: cs_at_opt_interp.h:86
cs_real_t * relax
Definition: cs_at_opt_interp.h:75
cs_at_opt_interp_t * cs_at_opt_interp_by_id(int id)
Return a pointer to an optimal interpolation based on its id.
Definition: cs_at_opt_interp.c:630
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
Definition: cs_at_opt_interp.h:57
#define END_C_DECLS
Definition: cs_defs.h:511
cs_real_t * model_to_obs_proj
Definition: cs_at_opt_interp.h:70
cs_at_opt_interp_type_t
Definition: cs_at_opt_interp.h:55
void cs_at_opt_interp_map_values(cs_at_opt_interp_t *oi, cs_measures_set_t *ms)
(re)Allocate and fill in an optimal interpolation structure from an optimal interpolation file...
Definition: cs_at_opt_interp.c:1296
int * cs_at_opt_interp_get_active_obs(cs_measures_set_t *ms, cs_at_opt_interp_t *oi, cs_field_t *f_oia, bool **inverse, int ***ao_idx)
Count active observations and compute time weights in case of unsteady.
Definition: cs_at_opt_interp.c:1436
int nb_times
Definition: cs_at_opt_interp.h:76
cs_real_t * obs_cov
Definition: cs_at_opt_interp.h:67
int ig_id
Definition: cs_at_opt_interp.h:66
cs_at_opt_interp_type_t interp_type
Definition: cs_at_opt_interp.h:69
cs_real_t * time_window
Definition: cs_at_opt_interp.h:82