38 #include <lifev/zero_dimensional/solver/ZeroDimensionalData.hpp> 56 M_voltageFileStream.close();
57 M_currentFileStream.close();
58 M_balanceFileStream.close();
66 const std::string& section )
69 M_time.reset (
new time_Type ( dataFile,
70 section +
"/time_discretization" ) );
72 std::string circuirDataFile = dataFile ( ( section +
"/CircuitDataFile" ).data(),
73 "./inputFilexx.dat" );
74 GetPot dataFileCircuit
( circuirDataFile
);
75 std::string circuitFile = dataFileCircuit
( "Files/InputFiles/CircuitFile", 76 "./circuitFilexx.dat" );
77 std::string folder = dataFileCircuit
( "Files/OutputFiles/Folder", 80 std::string voltageFile = folder +
"/" + dataFileCircuit (
"Files/OutputFiles/VoltageFile",
82 std::string currentFile = folder +
"/" + dataFileCircuit (
"Files/OutputFiles/CurrentFile",
84 std::string balanceFile = folder +
"/" + dataFileCircuit (
"Files/OutputFiles/BalanceCurrentinNode",
86 M_voltageFileStream.open ( voltageFile.c_str() );
87 M_currentFileStream.open ( currentFile.c_str() );
88 M_balanceFileStream.open ( balanceFile.c_str() );
91 M_circuitData->buildCircuit ( circuitFile.c_str(),
97 M_solverData.method = dataFile ( ( section +
"/Solver/method" ).data(),
"IRK" );
98 M_solverData.numberTimeStep = dataFile ( ( section +
"/Solver/numberTimeStep" ).data(), 1 );
99 M_solverData.maxError = dataFile ( ( section +
"/Solver/maxError" ).data(), 1.0 );
100 M_solverData.reltol = dataFile ( ( section +
"/Solver/reltol" ).data(), 0.1 );
101 M_solverData.abstol = dataFile ( ( section +
"/Solver/abstol" ).data(), 1.0 );
102 M_solverData.maxOrder = dataFile ( ( section +
"/Solver/maxOrder" ).data(), 1 );
103 M_solverData.verbose = dataFile ( ( section +
"/Solver/verbose" ).data(),
false );
104 M_solverData.verboseLevel = dataFile ( ( section +
"/Solver/verboseLevel" ).data(), 0 );
105 M_solverData.useNOX = dataFile ( ( section +
"/Solver/useNOX" ).data(),
false );
106 M_solverData.fixTimeStep = dataFile ( ( section +
"/Solver/fixTimeStep" ).data(),
true );
107 M_solverData.extraLSParamsFile = dataFile ( ( section +
"/Solver/extraLinearSolverParamsFile" ).data(),
"./Extra_AztecOO_Params.xml" );
108 M_solverData.linearSolverParamsFile = dataFile ( ( section +
"/Solver/linearSolverParamsUsedFile" ).data(),
"./lowsf.aztecoo.used.xml" );
121 for ( iterZeroDimensionalElement_Type theElement = elementList->begin(); theElement != elementList->end(); theElement++ )
123 ( *theElement )->setCurrent ( 0.0 );
124 ( *theElement )->setDeltaCurrent ( 0.0 );
128 for ( iterZeroDimensionalNode_Type theNode = nodeList->begin(); theNode != nodeList->end(); theNode++ )
130 ( *theNode )->setVoltage ( 0.0 );
131 ( *theNode )->setDeltaVoltage ( 0.0 );
138 Real time = M_time->time();
141 for ( iterZeroDimensionalElementCurrentSource_Type theElement = currentElementList->begin(); theElement != currentElementList->end(); theElement++ )
143 ( *theElement )->setCurrentByTime ( time );
144 std::cout << ( *theElement )->current() << std::endl;
148 for ( iterZeroDimensionalElementVoltageSourcePtr_Type theElement = voltageElementList->begin(); theElement != voltageElementList->end(); theElement++ )
150 ( *theElement )->setVoltageByTime ( time );
151 std::cout << ( *theElement )->voltage() << std::endl;
158 M_outPutFormat.writeDataFormat ( M_time->time(),
160 M_outPutFormat.space );
163 for ( iterZeroDimensionalElement_Type theElement = elementList->begin(); theElement != elementList->end(); theElement++ )
165 M_outPutFormat.writeDataFormat ( ( *theElement )->current(),
167 M_outPutFormat.space );
173 M_outPutFormat.writeDataFormat ( M_time->time(),
175 M_outPutFormat.space );
176 M_outPutFormat.writeDataFormat ( M_time->time(),
178 M_outPutFormat.space );
180 for ( iterZeroDimensionalNode_Type theNode = nodeList->begin(); theNode != nodeList->end(); theNode++ )
182 M_outPutFormat.writeDataFormat ( ( *theNode )->voltage(),
184 M_outPutFormat.space );
185 M_outPutFormat.writeDataFormat ( ( *theNode )->currentBalance(),
187 M_outPutFormat.space );
197 std::cout <<
"This MultiscaleModel0D::ShowVariables----------------------" << std::endl;
201 for ( iterZeroDimensionalNodeUnknown_Type theUnknownNode = Nodes->unknownNodeList()->begin(); theUnknownNode != Nodes->unknownNodeList()->end(); theUnknownNode++ )
203 ( *theUnknownNode )->showMe ( 1 );
206 for ( iterZeroDimensionalElementPassiveInductor_Type theInductor = Elements->inductorList() ->begin(); theInductor
207 != Elements->inductorList() ->end(); theInductor++ )
209 ( *theInductor )->showMe ( 1 );
222 for ( iterZeroDimensionalNodeUnknown_Type theUnknownNode = unKnownList->begin(); theUnknownNode != unKnownList->end(); theUnknownNode++ )
224 ( *theUnknownNode )->assignVariableIndex ( M_unknownCounter );
229 for ( iterZeroDimensionalElementPassiveInductor_Type theInductor = inductorList->begin(); theInductor != inductorList->end(); theInductor++ )
231 ( *theInductor )->assignVariableIndex ( M_unknownCounter );
240 M_outPutFormat.writeDataFormat (
"% time", M_currentFileStream, M_outPutFormat.space );
241 for ( iterZeroDimensionalElement_Type theElement = elementList->begin(); theElement != elementList->end(); theElement++ )
243 M_outPutFormat.writeDataFormat ( ( *theElement )->id(), M_currentFileStream, M_outPutFormat.space );
249 M_outPutFormat.writeDataFormat (
"% time", M_balanceFileStream, M_outPutFormat.space );
250 M_outPutFormat.writeDataFormat (
"% time", M_voltageFileStream, M_outPutFormat.space );
251 for ( iterZeroDimensionalNode_Type theNode = nodeList->begin(); theNode != nodeList->end(); theNode++ )
253 M_outPutFormat.writeDataFormat ( ( *theNode )->id(), M_voltageFileStream, M_outPutFormat.space );
254 M_outPutFormat.writeDataFormat ( ( *theNode )->id(), M_balanceFileStream, M_outPutFormat.space );
virtual ~ZeroDimensionalData()
Destructor.
std::shared_ptr< vecZeroDimensionalElementCurrentSourcePtr_Type > ptrVecZeroDimensionalElementCurrentSourcePtr_Type
void updateBC()
update source elements
std::shared_ptr< ZeroDimensionalNodeS > zeroDimensionalNodeSPtr_Type
std::ofstream M_balanceFileStream
void saveSolution()
save solution
ZeroDimensionalData()
Constructor.
std::ofstream M_voltageFileStream
std::shared_ptr< ZeroDimensionalElementS > zeroDimensionalElementSPtr_Type
void updateInverseJacobian(const UInt &iQuadPt)
std::shared_ptr< vecZeroDimensionalNodePtr_Type > ptrVecZeroDimensionalNodePtr_Type
double Real
Generic real data.
void initializeSolution()
initialize Solution
std::shared_ptr< vecZeroDimensionalElementPtr_Type > ptrVecZeroDimensionalElementPtr_Type
std::shared_ptr< vecZeroDimensionalElementVoltageSourcePtr_Type > ptrVecZeroDimensionalElementVoltageSourcePtr_Type
const std::string operator()(const char *VarName, const char *Default) const
std::ofstream M_currentFileStream
std::shared_ptr< vecZeroDimensionalNodeUnknownPtr_Type > ptrVecZeroDimensionalNodeUnknownPtr_Type
OutPutFormat M_outPutFormat
GetPot(const STRING_VECTOR &FileNameList)
void showMeVariables()
show variables
Data container for 0D model.
void setup(const GetPot &dataFile, bcPtr_Type bc, const std::string §ion="0D_Model")
setup model
std::shared_ptr< vecZeroDimensionalElementPassiveInductorPtr_Type > ptrVecZeroDimensionalElementPassiveInductorPtr_Type
void assignVaribleIndex()