My Project
programmer's 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-2019 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__ */
cs_interpol_grid_t
Definition: cs_measures_util.h:72
cs_at_opt_interp_t::time_window
cs_real_t * time_window
Definition: cs_at_opt_interp.h:82
cs_at_opt_interp_t::time_weights
cs_real_t * time_weights
Definition: cs_at_opt_interp.h:81
cs_at_opt_interp_t::model_to_obs_proj_idx
cs_lnum_t * model_to_obs_proj_idx
Definition: cs_at_opt_interp.h:71
cs_at_opt_interp_type_t
cs_at_opt_interp_type_t
Definition: cs_at_opt_interp.h:55
cs_defs.h
CS_AT_OPT_INTERP_P1
Definition: cs_at_opt_interp.h:58
cs_at_opt_interp_t::times
cs_real_t * times
Definition: cs_at_opt_interp.h:78
cs_at_opt_interp_t::obs_cov_is_diag
bool obs_cov_is_diag
Definition: cs_at_opt_interp.h:68
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_at_opt_interp_t::b_proj
cs_real_t * b_proj
Definition: cs_at_opt_interp.h:73
cs_at_opt_interp_is_p1_proj_needed
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....
Definition: cs_at_opt_interp.c:1278
cs_at_opt_interp_project_model_covariance
void cs_at_opt_interp_project_model_covariance(cs_measures_set_t *ms, cs_at_opt_interp_t *oi)
Compute $\tens{H}\tens{B}\transpose{\tens{H}}$.
Definition: cs_at_opt_interp.c:1375
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
cs_at_opt_interp_t::times_read
cs_real_t * times_read
Definition: cs_at_opt_interp.h:79
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_measures_util.h
cs_at_opt_interp_t::n_log_data
int n_log_data
Definition: cs_at_opt_interp.h:83
cs_at_opt_interp_t::name
const char * name
Definition: cs_at_opt_interp.h:64
cs_at_opt_interp_t::measures_idx
int * measures_idx
Definition: cs_at_opt_interp.h:77
cs_at_opt_interp_t::model_to_obs_proj_c_ids
cs_lnum_t * model_to_obs_proj_c_ids
Definition: cs_at_opt_interp.h:72
CS_AT_OPT_INTERP_P0
Definition: cs_at_opt_interp.h:57
cs_at_opt_interp_t::steady
int steady
Definition: cs_at_opt_interp.h:84
cs_at_opt_interp_by_id
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
cs_at_opt_interp_t::active_time
int * active_time
Definition: cs_at_opt_interp.h:80
cs_at_opt_interp_create
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
cs_at_opt_interp_obs_operator
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:1343
cs_field.h
cs_at_opt_interps_destroy
void cs_at_opt_interps_destroy(void)
Destroy all defined optimal interpolations.
Definition: cs_at_opt_interp.c:675
cs_at_opt_interp_t::relax
cs_real_t * relax
Definition: cs_at_opt_interp.h:75
cs_at_opt_interp_read_file
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
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_at_opt_interp_t::type_nudging
int type_nudging
Definition: cs_at_opt_interp.h:86
cs_at_opt_interp_t::id
int id
Definition: cs_at_opt_interp.h:65
cs_at_opt_interp_get_active_obs
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:1434
cs_at_opt_interp_map_values
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:1294
cs_at_opt_interp_by_name
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
cs_at_opt_interp_t::model_to_obs_proj
cs_real_t * model_to_obs_proj
Definition: cs_at_opt_interp.h:70
cs_at_opt_interp_t::ig_id
int ig_id
Definition: cs_at_opt_interp.h:66
cs_at_opt_interp_t::obs_cov
cs_real_t * obs_cov
Definition: cs_at_opt_interp.h:67
cs_at_opt_interp_t::interp_type
cs_at_opt_interp_type_t interp_type
Definition: cs_at_opt_interp.h:69
cs_field_t
Field descriptor.
Definition: cs_field.h:124
cs_at_opt_interp_compute_analysis
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:1598
cs_at_opt_interp_t::nb_times
int nb_times
Definition: cs_at_opt_interp.h:76
cs_measures_set_t
Definition: cs_measures_util.h:47
cs_at_opt_interp_t::frequency
int frequency
Definition: cs_at_opt_interp.h:85
cs_at_opt_interp_t
Definition: cs_at_opt_interp.h:62