OpenFAST
Wind turbine multiphysics simulator
maperror.h
1 /****************************************************************
2  * Copyright (C) 2014 mdm *
3  * map[dot]plus[dot]plus[dot]help[at]gmail *
4  * *
5  * Licensed to the Apache Software Foundation (ASF) under one *
6  * or more contributor license agreements. See the NOTICE file *
7  * distributed with this work for additional information *
8  * regarding copyright ownership. The ASF licenses this file *
9  * to you under the Apache License, Version 2.0 (the *
10  * "License"); you may not use this file except in compliance *
11  * with the License. You may obtain a copy of the License at *
12  * *
13  * http://www.apache.org/licenses/LICENSE-2.0 *
14  * *
15  * Unless required by applicable law or agreed to in writing, *
16  * software distributed under the License is distributed on an *
17  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
18  * KIND, either express or implied. See the License for the *
19  * specific language governing permissions and limitations *
20  * under the License. *
21  ****************************************************************/
22 
23 
24 #ifndef _MAPERROR_H
25 #define _MAPERROR_H
26 
27 
28 #include "map.h"
29 #include <stdarg.h>
30 
31 
32 typedef enum MAP_ERROR_CODE {
33  MAP_SAFE , // = 0 by default
34  MAP_WARNING , // = 1
35  MAP_ERROR , // = 2
36  MAP_FATAL , // = 3
37 
38  // These are used internally to the program and are used to
39  // map text to the specific error code
40  MAP_FATAL_4 , // Failed to allocate memory for 'initializaion data'
41  MAP_FATAL_5 , // Failed to allocate memory for 'input data'
42  MAP_FATAL_6 , // Failed to allocate memory for 'parameter data'
43  MAP_FATAL_7 , // Failed to allocate memory for 'continuous data'
44  MAP_FATAL_8 , // Failed to allocate memory for 'model data'
45  MAP_FATAL_9 , // Failed to allocate memory for 'constraint data'
46  MAP_FATAL_10 , // Failed to allocate memory for 'output data'
47  MAP_FATAL_11 , // Failed to allocate memory for 'initialization output data'
48  MAP_FATAL_12 , // Failed to convert diameter to double. Check the MAP input file.
49  MAP_FATAL_13 , // Failed to convert mass density parameter in air in the cable library to a double. Check the MAP input file
50  MAP_FATAL_14 , // Failed to convert axial stiffness parameter in the cable library to a double. Check the MAP input file
51  MAP_FATAL_15 , // Failed to convert cable/seabed friction parameter in the cable library to a double. Check the MAP input file
52  MAP_FATAL_16 , // Could not complete the initialization process in MAP_Init() beause of either syntax errors in the input file or memory allocation problems
53  MAP_FATAL_17 , // A Node 'X' VarType could not be converted to a numeric value. Check the MAP input file
54  MAP_FATAL_18 , // A Node 'Y' VarType could not be converted to a numeric value. Check the MAP input file
55  MAP_FATAL_19 , // A Node 'Z' VarType could not be converted to a numeric value. Check the MAP input file
56  MAP_FATAL_20 , // A Node 'M' VarType could not be converted to a numeric value. Check the MAP input file
57  MAP_FATAL_21 , // A Node 'B' VarType could not be converted to a numeric value. Check the MAP input file
58  MAP_FATAL_22 , // A Node 'FX' VarType could not be converted to a numeric value. Check the MAP input file
59  MAP_FATAL_23 , // A Node 'FY' VarType could not be converted to a numeric value. Check the MAP input file
60  MAP_FATAL_24 , // A Node 'FZ' VarType could not be converted to a numeric value. Check the MAP input file
61  MAP_FATAL_25 , // Node is assigned an invalid type
62  MAP_FATAL_26 , // Line unstretched length could not be converted to a numeric value. Check the MAP input file
63  MAP_FATAL_27 , // Invalid line LineType assignment. Cannot find a LineType in the line dictionary. Check the MAP input file for consistency
64  MAP_FATAL_28 , // NodeAnch is an invalid anchor type for an line. can not convert value to a float. Check the MAP input file
65  MAP_FATAL_29 , // NodeFiar is an invalid anchor type for an line. can not convert value to a float. Check the MAP input file
66  MAP_FATAL_30 , // Attempting to assign an invalid anchor node to an line
67  MAP_FATAL_31 , // Attempting to assign an invalid fairlead node to an line
68  MAP_FATAL_32 , // An line property is set incorrectly in the MAP input file
69  MAP_FATAL_33 , // Could not complete the initialization process in MAP_Init() beause of syntax errors in the MAP input file. Check the 'MODEL OPTIONS' section of the MAP input file
70  MAP_FATAL_34 , // Could convert a 'REPEAT' parameter to a numeric value. Check the MAP input file
71  MAP_FATAL_35 , // Failed to allocate memory for the 'REPEAT' array
72  MAP_FATAL_36 , // Vessel reference origin is not set correctly. Check the MAP input file
73  MAP_FATAL_37 , // Failed to write the MAP summary file
74  MAP_FATAL_38 , // Could not create the summary file
75  MAP_FATAL_39 , // Could not run the first solve. Solver option (INNER_FTOL, INNER_GTOL, INNER_XTOL, INNER_MAX_ITS) could be inadvertendly set to a negative value
76  MAP_FATAL_40 , // Number of function calls has reached or exceeded INNER_MAX_ITS
77  MAP_FATAL_41 , // Cable mass density is zero. Neutrally buoyant cables cannot be solved using quasi-statis model
78  MAP_FATAL_42 , // Indexing error
79  MAP_FATAL_43 , // Failed to allocate memory for 'other data'
80  MAP_FATAL_44 , // Failed to allocate memory for internal state 'z'
81  MAP_FATAL_45 , // Failed to allocate memory for internal state 'u'
82  MAP_FATAL_46 , // Failed to allocate memory for internal state 'y'
83  MAP_FATAL_47 , // Out of memory
84  MAP_FATAL_48 , // init internal state does not exist. Memory allocation error
85  MAP_FATAL_49 , // Length of internal other state array and fortran derivived type do not match
86  MAP_FATAL_50 , // Length of internal input state array and fortran derivived type do not match
87  MAP_FATAL_51 , // Length of internal output state array and fortran derivived type do not match
88  MAP_FATAL_52 , // Length of internal constraint state array and fortran derivived type do not match
89  MAP_FATAL_53 , // Could not allocate memory for H/V constraint state
90  MAP_FATAL_54 , // Local cooridinates are computed incorrectly. Line horizontal excusion is negative
91  MAP_FATAL_55 , // Local cooridinates are computed incorrectly. Line vertical excusion is negative
92  MAP_FATAL_56 , // Line unstretched length cannot be negative
93  MAP_FATAL_57 , // Line axial stiffness cannot be negative
94  MAP_FATAL_58 , // Unstretched line length is too large for the quasi-static model (double backing)
95  MAP_FATAL_59 , // Approached a geometric limitation that the MSQS model is unable to solve
96  MAP_FATAL_60 , // Solver failed in updates
97  MAP_FATAL_61 , // Failed during linearization process
98  MAP_FATAL_62 , // Failed during linearization process: fd on surge direction
99  MAP_FATAL_63 , // Failed during linearization process: fd on sway direction
100  MAP_FATAL_64 , // Failed during linearization process: fd on heave direction
101  MAP_FATAL_65 , // Failed during linearization process: fd on roll direction
102  MAP_FATAL_66 , // Failed during linearization process: fd on pitch direction
103  MAP_FATAL_67 , // Failed during linearization process: fd on yaw direction
104  MAP_FATAL_68 , // Failed in nullifying the vessel properties
105  MAP_FATAL_69 , // Failed to allocate memory for the vessel
106  MAP_FATAL_70 , // Failed to write node information to the MAP summary file
107  MAP_FATAL_71 , // Assigning 'DEPTH' parameter to a node that is not fixed
108  MAP_FATAL_72 , // Failed to allocate memory for outer loop solution
109  MAP_FATAL_73 , // Failed to free memory for outer loop solution
110  MAP_FATAL_74 , // Zero pivot detected in LU factorization. Simulation terminated
111  MAP_FATAL_75 , // Backward difference Jacobian failed.
112  MAP_FATAL_76 , // Central difference Jacobian failed.
113  MAP_FATAL_77 , // Forward difference Jacobian failed.
114  MAP_FATAL_78 , // Line line failed to converge durring finite difference operation. Outer-loop Jacbobian failure:
115  MAP_FATAL_79 , // Solution failed in MinPack LMDER
116  MAP_FATAL_80 , // Maximum outer-loop iterations reached
117  MAP_FATAL_81 , // Failed to convert CIntDamp internal structural damping parameter in the cable library to a double. Check the MAP input file
118  MAP_FATAL_82 , // Failed to convert Ca added mass in the cable library to a double. Check the MAP input file
119  MAP_FATAL_83 , // Failed to convert Cdn cross-flow drag coefficient parameter in the cable library to a double. Check the MAP input file
120  MAP_FATAL_84 , // Failed to convert Cdt tangent-flow drag coefficient parameter in the cable library to a double. Check the MAP input file
121  MAP_FATAL_85 , // Error processing 'HELP' flag in the MAP input file
122  MAP_FATAL_86 , // Line out of range. This error was triggered in the initialization. This is likely due to incorrect settings in the MAP input file
123  MAP_FATAL_87 , // Line linear spring solver failed.
124  MAP_FATAL_88 , // Line failed
125  MAP_FATAL_89 , // Input index array exceeded during UpdateStates. Inputs were not set correctly by the program
126  MAP_FATAL_90 , // L^2 norm is too large. MAP may not have converged
127  MAP_FATAL_91 , // Krylov acceleration routine failure
128  MAP_FATAL_92 , // Failed inside Newton foot-finding iteration
129  MAP_FATAL_93 , // Newton failed to converge inside the node sequece. Try adjusting tolerance levels or change Krylov accelerator: option 'KRYLOV_ACCELERATOR <int>'",
130  MAP_FATAL_94 , // Krylov accelerator failed to converge inside the node solve sequence. Try adjusting tolerance levels or switch to the unmodified Newton step",
131  MAP_FATAL_95 , // Could not create the MAP initialization output file
132  MAP_FATAL_96 , // Atempting to run option KRYLOV_ACCELERATOR without LAPACK libraries compiled in. This option is not available without the LAPACK library
133  MAP_FATAL_97 , // Cannot associate constriaint variable in UpdateStates",
134  MAP_FATAL_98 , // Cannot associate constriaint variable in CalcOutput",
135  MAP_ERROR_1 , // Line option 'DAMAGE_TIME' does not trail with a valid value. Ignoring this run-time flag. Chek the MAP input file
136  MAP_ERROR_2 , // Value for 'INNER_FTOL' is not a valid numeric value. Using the default value <1e-6>
137  MAP_ERROR_3 , // Value for 'OUTER_TOL' is not a valid numeric value. Using the default value <1e-6>
138  MAP_ERROR_4 , // Value for 'INNER_MAX_ITS' is not a valid numeric value. Using the default value <500>
139  MAP_ERROR_5 , // Value for 'OUTER_MAX_ITS' is not a valid numeric value. Using the default value <500>
140  MAP_ERROR_6 , // Failed to write cable library information to the MAP summary file
141  MAP_ERROR_7 , // Failed to write node information to the MAP summary file
142  MAP_ERROR_8 , // Failed to write line information to the MAP summary file
143  MAP_ERROR_9 , // Value for 'INNER_GTOL' is not a valid numeric value. Using the default value <1e-6>
144  MAP_ERROR_10 , // Value for 'INNER_XTOL' is not a valid numeric value. Using the default value <1e-6>
145  MAP_ERROR_11 , // INNER_FTOL is too small. No further reduction in the sum of squares is possible
146  MAP_ERROR_12 , // INNER_GTOL is too small. No further reduction in the sum of squares is possible
147  MAP_ERROR_13 , // INNER_XTOL is too small. No further reduction in the sum of squares is possible
148  MAP_ERROR_14 , // Line option 'DIAGNOSTIC' does not trail with a valid value. Defaulting is to run diagnostic for the first iteration only
149  MAP_ERROR_15 , // Value for 'INTEGRATION_DT' is not a valid input. No support for the LM/FEA model at this time.
150  MAP_ERROR_16 , // Value for 'KB_DEFAULT' is not a valid numeric value. Using the default value <3.0E6 N/m>
151  MAP_ERROR_17 , // Value for 'CB_DEFAULT' is not a valid numeric value. Using the default value <3.0E5 Ns/m>
152  MAP_ERROR_18 , // Value for 'SEG_SIZE' is not a valid numeric value. Using the default value <10>
153  MAP_WARNING_1 , // Extra characters are present in the cable library portion of the MAP input file
154  MAP_WARNING_2 , // Extra characters are present in the node library portion of the MAP input file
155  MAP_WARNING_3 , // Unrecognized line run-time option
156  MAP_WARNING_4 , // Unrecognized model option
157  MAP_WARNING_5 , // Cable density is approaching the density of seawater
158  MAP_WARNING_6 , // The line's anchor and fairlead point occupy the same point in space.
159  MAP_WARNING_7 , // Option outer_tol must be greater than machine epsilon
160  MAP_WARNING_8 , // Invalid parameters for PG_COOKED option: using default value of ds = 1.0, d = 0.0
161  MAP_WARNING_9 , // Attemping to recover from fatal error by back tracking...
162  MAP_WARNING_10, // Ignoring wave kinematic hydrodynamics. This feature is not available
163  MAP_WARNING_11, // Could not enable the lumped-mass model during initialization
164  MAP_WARNING_12, // Line option 'KRYLOV_ACCELERATOR' does not trail with a valid integer. Defaulting to initialized MMAX value
165  MAP_WARNING_13, // Line options 'KRYLOV_ACCELERATOR' and 'PG_COOKED' are not compatible together. Disabling Krylov acceleration
166  MAP_WARNING_14, // Conflicting options. Cannot use Powell's method in conjuction with KRYLOV_ACCELERATOR or PG_COOKED
167  MAP_WARNING_15, // Failed to free a variable
168 } MAP_ERROR_CODE ;
169 
170 
177 void map_reset_universal_error(char* map_msg, MAP_ERROR_CODE* ierr);
178 
179 
194 void set_universal_error_with_message(char* map_msg, MAP_ERROR_CODE* ierr, const MAP_ERROR_CODE new_error_code, const char* in_string, ...);
195 
196 
208 void set_universal_error(char* map_msg, MAP_ERROR_CODE* ierr, const MAP_ERROR_CODE new_error_code);
209 
210 
211 #endif // _MAPERROR_H