LifeV
FSIData.cpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief DataFSI - File containing a data container for FSI problems
30 
31  @author Cristiano Malossi <cristiano.malossi@epfl.ch>
32  @author Gilles fourestey <gilles.fourestey@epfl.ch>
33  @date 10-06-2010
34 
35  @contributor Simone Deparis <simone.deparis@epfl.ch>
36  @maintainer Simone Deparis <simone.deparis@epfl.ch>
37  */
38 
39 
40 #include <lifev/fsi/solver/FSIData.hpp>
41 
42 namespace LifeV
43 {
44 
45 // ===================================================
46 // Constructors
47 // ===================================================
48 FSIData::FSIData( ) :
49  M_dataFluid ( new dataFluid_Type() ),
50  M_dataSolid ( new dataSolid_Type() ),
51  M_maxSubIterationNumber (),
52  M_absoluteTolerance (),
53  M_relativeTolerance (),
54  M_errorTolerance (),
55  M_NonLinearLineSearch (),
56  M_method (),
57  M_algorithm (),
58  M_defaultOmega (),
59  M_rangeOmega (),
60  M_updateEvery (),
61  M_fluidInterfaceFlag (),
62  M_structureInterfaceFlag (),
63  M_fluidInterfaceVertexFlag (),
64  M_structureInterfaceVertexFlag (),
65  M_interfaceTolerance ()
66 {
67 }
68 
69 FSIData::FSIData ( const FSIData& FSIData ) :
70  M_dataFluid ( FSIData.M_dataFluid ),
71  M_dataSolid ( FSIData.M_dataSolid ),
72  M_maxSubIterationNumber ( FSIData.M_maxSubIterationNumber ),
73  M_absoluteTolerance ( FSIData.M_absoluteTolerance ),
74  M_relativeTolerance ( FSIData.M_relativeTolerance ),
75  M_errorTolerance ( FSIData.M_errorTolerance ),
76  M_NonLinearLineSearch ( FSIData.M_NonLinearLineSearch ),
77  M_method ( FSIData.M_method ),
78  M_algorithm ( FSIData.M_algorithm ),
79  M_defaultOmega ( FSIData.M_defaultOmega ),
80  M_rangeOmega ( FSIData.M_rangeOmega ),
81  M_updateEvery ( FSIData.M_updateEvery ),
82  M_fluidInterfaceFlag ( FSIData.M_fluidInterfaceFlag ),
83  M_structureInterfaceFlag ( FSIData.M_structureInterfaceFlag ),
84  M_fluidInterfaceVertexFlag ( new Int const ( *FSIData.M_fluidInterfaceVertexFlag ) ),
85  M_structureInterfaceVertexFlag ( new Int const ( *FSIData.M_structureInterfaceVertexFlag ) ),
86  M_interfaceTolerance ( FSIData.M_interfaceTolerance ),
87  M_restartTimeStep ( 0. )
88 {
89 }
90 
91 
92 // ===================================================
93 // Methods
94 // ===================================================
95 FSIData&
96 FSIData::operator= ( const FSIData& FSIData )
97 {
98  if ( this != &FSIData )
99  {
100  M_dataFluid = FSIData.M_dataFluid;
101  M_dataSolid = FSIData.M_dataSolid;
102  M_maxSubIterationNumber = FSIData.M_maxSubIterationNumber;
103  M_absoluteTolerance = FSIData.M_absoluteTolerance;
104  M_relativeTolerance = FSIData.M_relativeTolerance;
105  M_errorTolerance = FSIData.M_errorTolerance;
106  M_NonLinearLineSearch = FSIData.M_NonLinearLineSearch;
107  M_method = FSIData.M_method;
108  M_algorithm = FSIData.M_algorithm;
109  M_defaultOmega = FSIData.M_defaultOmega;
110  M_rangeOmega = FSIData.M_rangeOmega;
111  M_updateEvery = FSIData.M_updateEvery;
112  M_fluidInterfaceFlag = FSIData.M_fluidInterfaceFlag;
113  M_structureInterfaceFlag = FSIData.M_structureInterfaceFlag;
114 
115  M_fluidInterfaceVertexFlag.reset ( new Int const ( *FSIData.M_fluidInterfaceVertexFlag ) );
116  M_structureInterfaceVertexFlag.reset ( new Int const ( *FSIData.M_structureInterfaceVertexFlag ) );
117 
118  M_interfaceTolerance = FSIData.M_interfaceTolerance;
119  }
120 
121  return *this;
122 }
123 
124 void
125 FSIData::setup ( const GetPot& dataFile, const std::string& section )
126 {
127  if ( !M_timeALE.get() )
128  {
129  M_timeALE.reset ( new time_Type ( dataFile, "mesh_motion/time_discretization" ) );
130  }
131 
132  if ( !M_timeAdvanceALE.get() )
133  {
134  M_timeAdvanceALE.reset ( new timeAdvance_Type ( dataFile, "mesh_motion/time_discretization" ) );
135  }
136 
137  M_dataFluid->setup ( dataFile );
138  M_dataSolid->setup ( dataFile );
139 
140  // Problem - Non Linear Richardson Parameters
141  M_maxSubIterationNumber = dataFile ( ( section + "/maxSubIter" ).data(), 300 );
142  M_absoluteTolerance = dataFile ( ( section + "/abstol" ).data(), 1.e-07 );
143  M_relativeTolerance = dataFile ( ( section + "/reltol" ).data(), 1.e-04 );
144  M_errorTolerance = dataFile ( ( section + "/etamax" ).data(), 1.e-03 );
145  M_NonLinearLineSearch = static_cast<Int> ( dataFile ( ( section + "/NonLinearLineSearch" ).data(), 0 ) );
146 
147  // Problem - Methods
148  M_method = dataFile ( ( section + "/method" ).data(), "steklovPoincare" );
149  M_algorithm = dataFile ( ( section + "/algorithm" ).data(), "DirichletNeumann" );
150 
151  // Problem - FixPoint / EJ
152  M_defaultOmega = dataFile ( ( section + "/defOmega" ).data(), 0.001);
153  M_rangeOmega[0] = dataFile ( ( section + "/defOmega" ).data(), std::fabs ( M_defaultOmega ) /**1024.*/, 0);
154  M_rangeOmega[1] = dataFile ( ( section + "/defOmega" ).data(), std::fabs ( M_defaultOmega ) /*/1024.*/, 1);
155  M_updateEvery = dataFile ( ( section + "/updateEvery" ).data(), 1);
156 
157  // Interface
158  M_fluidInterfaceFlag = dataFile ( "interface/fluid_flag", 1 );
159  M_structureInterfaceFlag = dataFile ( "interface/solid_flag", M_fluidInterfaceFlag );
160 
161  Int vertexFlag;
162  vertexFlag = dataFile ( "interface/edgeFlag", -1 );
163  vertexFlag = dataFile ( "interface/fluid_vertex_flag", vertexFlag );
164 
165  if (vertexFlag >= 0)
166  {
167  M_fluidInterfaceVertexFlag.reset ( new Int const ( vertexFlag ) );
168  }
169 
170  vertexFlag = dataFile ( "interface/structure_vertex_flag", -1 );
171  if (vertexFlag >= 0)
172  {
173  M_structureInterfaceVertexFlag.reset ( new Int const ( vertexFlag ) );
174  }
175 
176  M_interfaceTolerance = dataFile ( "interface/tolerance", 0. );
177 
178  M_restartTimeStep = dataFile ( "importer/restart_timestep", 0. );
179 }
180 
181 bool
182 FSIData::isMonolithic()
183 {
184  return ! ( M_method.compare ( "monolithicGE" ) && M_method.compare ( "monolithicGI" ) );
185 }
186 
187 void
188 FSIData::showMe ( std::ostream& output )
189 {
190  output << "\n*** Values for data fluid\n\n";
191  M_dataFluid->showMe();
192 
193  output << "\n*** Values for data solid\n\n";
194  M_dataSolid->showMe();
195 
196  output << "\n*** Values for problem\n\n";
197  output << "Max subiteration number = " << M_maxSubIterationNumber << std::endl;
198  output << "Absolute tolerance = " << M_absoluteTolerance << std::endl;
199  output << "Relative tolerance = " << M_relativeTolerance << std::endl;
200  output << "Max error tolerance = " << M_errorTolerance << std::endl;
201  output << "NonLinearLineSearch = " << M_NonLinearLineSearch << std::endl;
202 
203  output << "Method = " << M_method << std::endl;
204  output << "Algorithm = " << M_algorithm << std::endl;
205 
206  output << "Default Omega = " << M_defaultOmega << std::endl;
207  output << "Omega range = " << "(" << M_rangeOmega[0] << " " << M_rangeOmega[1] << ")" << std::endl;
208  output << "Update every = " << M_updateEvery << std::endl;
209 
210  output << "\n*** Values for interface\n\n";
211  output << "Interface fluid = " << M_fluidInterfaceFlag << std::endl;
212  output << "Interface structure = " << M_structureInterfaceFlag << std::endl;
213  if (M_fluidInterfaceVertexFlag.get() != 0)
214  {
215  output << "Interface fluid vertices = " << *M_fluidInterfaceVertexFlag << std::endl;
216  }
217  if (M_structureInterfaceVertexFlag.get() != 0)
218  {
219  output << "Interface structure vertices = " << *M_structureInterfaceVertexFlag << std::endl;
220  }
221  output << "Interface tolerance = " << M_interfaceTolerance << std::endl;
222 }
223 
224 }
double operator()(const char *VarName, const double &Default) const
Definition: GetPot.hpp:2033
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
void updateInverseJacobian(const UInt &iQuadPt)
int operator()(const char *VarName, int Default) const
Definition: GetPot.hpp:2021