-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDarcyArgs.C
More file actions
107 lines (94 loc) · 2.93 KB
/
Copy pathDarcyArgs.C
File metadata and controls
107 lines (94 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// $Id$
//==============================================================================
//!
//! \file DarcyArgs.C
//!
//! \date Sep 15 2021
//!
//! \author Arne Morten Kvarving / SINTEF
//!
//! \brief Preparsing of input files for the Darcy application.
//!
//==============================================================================
#include "DarcyArgs.h"
#include "ASMmxBase.h"
#include "Utilities.h"
#include <string>
#include <strings.h>
#include "tinyxml2.h"
bool DarcyArgs::parseArg (const char* argv)
{
if (argv[0] != '-')
return false;
else if (strcasecmp(argv, "-tracer") == 0)
tracer = true;
else if (strcmp(argv, "-mixed1") == 0)
mixed = 1;
else if (strcmp(argv, "-mixed") == 0)
mixed = 2;
else if (strcmp(argv, "-Mixed1") == 0)
mixed = 11;
else if (strcmp(argv, "-Mixed") == 0)
mixed = 12;
else if (strcmp(argv, "-AL") == 0)
useAL = true;
else if (TimeIntegration::Method tm = TimeIntegration::get(argv+1);
tm > TimeIntegration::NONE)
timeMethod = tm;
else
return this->SIMargsBase::parseArg(argv);
return true;
}
bool DarcyArgs::parseArgComplex (int argc, char** argv, int& i)
{
if (strcasecmp(argv[i],"-adap"))
return this->parseArg(argv[i]);
adap = true;
int j = i+1;
if (j >= argc || argv[j][0] == '-')
adNorm = DCY::PRESSURE_H1;
else if (strcasecmp(argv[j], "pressure") == 0)
adNorm = DCY::PRESSURE_H1, ++i;
else if (strcasecmp(argv[j], "recovery_press") == 0)
adNorm = DCY::RECOVERY_PRESSURE, ++i;
else if (strcasecmp(argv[j], "concentration") == 0)
adNorm = DCY::CONCENTRATION_H1, ++i;
else if (strcasecmp(argv[j], "recovery_conc") == 0)
adNorm = DCY::RECOVERY_CONCENTRATION, ++i;
else if (strcasecmp(argv[j], "total") == 0)
adNorm = DCY::TOTAL_H1, ++i;
else if (strcasecmp(argv[j], "recovery") == 0)
adNorm = DCY::RECOVERY, ++i;
else
adNorm = DCY::PRESSURE_H1;
return true;
}
bool DarcyArgs::parse (const tinyxml2::XMLElement* elem)
{
if (!strcasecmp(elem->Value(),"timestepping")) {
std::string type;
if (utl::getAttribute(elem,"type",type))
timeMethod = TimeIntegration::get(type);
}
else if (!strcasecmp(elem->Value(),"darcy")) {
utl::getAttribute(elem,"tracer",tracer);
ASMmxBase::Type = ASMmxBase::NONE;
if (const char* ad = elem->Attribute("adap"); ad) {
if (strcasecmp(ad,"pressure") == 0)
adNorm = DCY::PRESSURE_H1;
else if (strcasecmp(ad,"recovery_press") == 0)
adNorm = DCY::RECOVERY_PRESSURE;
else if (strcasecmp(ad,"concentration") == 0)
adNorm = DCY::CONCENTRATION_H1;
else if (strcasecmp(ad,"recovery_conc") == 0)
adNorm = DCY::RECOVERY_CONCENTRATION;
else if (strcasecmp(ad,"total") == 0)
adNorm = DCY::TOTAL_H1;
else if (strcasecmp(ad,"recovery") == 0)
adNorm = DCY::RECOVERY;
}
if (elem->FirstChildElement("schedule"))
scheduled = true;
}
return this->SIMargsBase::parse(elem);
}