~ubuntu-branches/ubuntu/precise/code-saturne/precise

« back to all changes in this revision

Viewing changes to src/gui/cs_gui_conjugate_heat_transfer.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-24 00:00:08 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20111124000008-2vo99e38267942q5
Tags: 2.1.0-3
Install a missing file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*============================================================================
 
2
 * Management of the GUI parameters file: conjugate heat transfer
 
3
 *============================================================================*/
 
4
 
 
5
/*
 
6
  This file is part of Code_Saturne, a general-purpose CFD tool.
 
7
 
 
8
  Copyright (C) 1998-2011 EDF S.A.
 
9
 
 
10
  This program is free software; you can redistribute it and/or modify it under
 
11
  the terms of the GNU General Public License as published by the Free Software
 
12
  Foundation; either version 2 of the License, or (at your option) any later
 
13
  version.
 
14
 
 
15
  This program is distributed in the hope that it will be useful, but WITHOUT
 
16
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
17
  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
18
  details.
 
19
 
 
20
  You should have received a copy of the GNU General Public License along with
 
21
  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
22
  Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
23
*/
 
24
 
 
25
/*----------------------------------------------------------------------------*/
 
26
 
 
27
#if defined(HAVE_CONFIG_H)
 
28
#include "cs_config.h"
 
29
#endif
 
30
 
 
31
/*----------------------------------------------------------------------------
 
32
 * Standard C library headers
 
33
 *----------------------------------------------------------------------------*/
 
34
 
 
35
#include <stdio.h>
 
36
#include <stdlib.h>
 
37
#include <math.h>
 
38
#include <string.h>
 
39
#include <fcntl.h>
 
40
#include <unistd.h>
 
41
#include <assert.h>
 
42
 
 
43
/*----------------------------------------------------------------------------
 
44
 * BFT library headers
 
45
 *----------------------------------------------------------------------------*/
 
46
 
 
47
#include <bft_mem.h>
 
48
#include <bft_error.h>
 
49
#include <bft_printf.h>
 
50
 
 
51
/*----------------------------------------------------------------------------
 
52
 * FVM library headers
 
53
 *----------------------------------------------------------------------------*/
 
54
 
 
55
#include "fvm_selector.h"
 
56
 
 
57
/*----------------------------------------------------------------------------
 
58
 * MEI library headers
 
59
 *----------------------------------------------------------------------------*/
 
60
 
 
61
#include "mei_evaluate.h"
 
62
 
 
63
/*----------------------------------------------------------------------------
 
64
 * Local headers
 
65
 *----------------------------------------------------------------------------*/
 
66
 
 
67
#include "cs_base.h"
 
68
#include "cs_gui_util.h"
 
69
#include "cs_gui_variables.h"
 
70
#include "cs_gui_boundary_conditions.h"
 
71
#include "cs_mesh.h"
 
72
#include "cs_prototypes.h"
 
73
#include "cs_syr_coupling.h"
 
74
 
 
75
/*----------------------------------------------------------------------------
 
76
 * Header for the current file
 
77
 *----------------------------------------------------------------------------*/
 
78
 
 
79
#include "cs_gui_conjugate_heat_transfer.h"
 
80
 
 
81
/*----------------------------------------------------------------------------*/
 
82
 
 
83
BEGIN_C_DECLS
 
84
 
 
85
/*=============================================================================
 
86
 * Local Macro Definitions
 
87
 *============================================================================*/
 
88
 
 
89
/* debugging switch */
 
90
#define _XML_DEBUG_ 0
 
91
 
 
92
/*============================================================================
 
93
 * Private function definitions
 
94
 *============================================================================*/
 
95
 
 
96
/*-----------------------------------------------------------------------------
 
97
 * Return the value to the asociated markup.
 
98
 *
 
99
 * parameter:
 
100
 *   keyword    --> label of the markup
 
101
 *   number     --> number of the syrthes coupling
 
102
 *----------------------------------------------------------------------------*/
 
103
 
 
104
static char*
 
105
_get_syrthes_coupling(const char* keyword, const int number)
 
106
{
 
107
    char* value = NULL;
 
108
    char *path = cs_xpath_init_path();
 
109
    cs_xpath_add_elements(&path, 3, "thermophysical_models",
 
110
                                    "conjugate_heat_transfer",
 
111
                                    "external_coupling");
 
112
    cs_xpath_add_element_num(&path, "syrthes", number);
 
113
    cs_xpath_add_element(&path, keyword);
 
114
    cs_xpath_add_function_text(&path);
 
115
    value = cs_gui_get_text_value(path);
 
116
    BFT_FREE(path);
 
117
    return value;
 
118
}
 
119
 
 
120
/*============================================================================
 
121
 * Public Fortran function definitions
 
122
 *============================================================================*/
 
123
 
 
124
/*-----------------------------------------------------------------------------
 
125
 * Define new SYRTHES coupling.
 
126
 *
 
127
 * In the case of a single Code_Saturne and single SYRTHES instance, the
 
128
 * syrthes_name argument is ignored.
 
129
 *
 
130
 * In case of multiple couplings, a coupling will be matched with available
 
131
 * SYRTHES instances prioritarily based on the syrthes_name argument.
 
132
 *
 
133
 * subroutine uisyrc
 
134
 * *****************
 
135
 *
 
136
 *----------------------------------------------------------------------------*/
 
137
 
 
138
void CS_PROCF (uisyrc, UISYRC) (void)
 
139
{
 
140
    int izone;
 
141
    int verbosity = 0;
 
142
    int visualization = 1;
 
143
    char* syrthes_name = NULL;
 
144
    char* syrthes_verbosity = NULL;
 
145
    char* syrthes_visu = NULL;
 
146
    char* projection_axis = NULL;
 
147
    char* boundary_criteria = NULL;
 
148
    char* volume_criteria = NULL;
 
149
 
 
150
    int coupling =
 
151
      cs_gui_get_tag_number("/conjugate_heat_transfer/external_coupling/syrthes",
 
152
                            1);
 
153
 
 
154
    for (izone=0 ; izone < coupling ; izone++)
 
155
    {
 
156
      syrthes_name      = _get_syrthes_coupling("syrthes_name",       izone+1);
 
157
      syrthes_verbosity = _get_syrthes_coupling("verbosity",          izone+1);
 
158
      syrthes_visu      = _get_syrthes_coupling("visualization",      izone+1);
 
159
      projection_axis   = _get_syrthes_coupling("projection_axis",    izone+1);
 
160
      boundary_criteria = _get_syrthes_coupling("selection_criteria", izone+1);
 
161
 
 
162
      if (syrthes_verbosity != NULL)
 
163
        verbosity = atoi(syrthes_verbosity);
 
164
 
 
165
      if (syrthes_visu != NULL)
 
166
        visualization = atoi(syrthes_visu);
 
167
 
 
168
      cs_syr_coupling_define(syrthes_name,
 
169
                             boundary_criteria,
 
170
                             volume_criteria,
 
171
                             *projection_axis,
 
172
                             verbosity,
 
173
                             visualization);
 
174
 
 
175
#if _XML_DEBUG_
 
176
      bft_printf("==>uisyrc\n");
 
177
      bft_printf("--syrthes_name          = %s\n", syrthes_name);
 
178
      bft_printf("--syrthes_verbosity     = %s\n", syrthes_verbosity);
 
179
      bft_printf("--syrthes_visualization = %s\n", syrthes_visu);
 
180
      bft_printf("--boundary_criteria     = %s\n", boundary_criteria);
 
181
      bft_printf("--projection_axis       = %s\n", projection_axis);
 
182
#endif
 
183
      BFT_FREE(syrthes_name);
 
184
      BFT_FREE(syrthes_verbosity);
 
185
      BFT_FREE(syrthes_visu);
 
186
      BFT_FREE(projection_axis);
 
187
      BFT_FREE(boundary_criteria);
 
188
 
 
189
    }
 
190
}
 
191
 
 
192
/*----------------------------------------------------------------------------*/
 
193
 
 
194
END_C_DECLS