Commit 363de1eb authored by Chris Cantwell's avatar Chris Cantwell

Added Field metadata to cell checkpointing for start time on restart.

Fixed cell variable names in CRN cell model.
Fixed error in reading and writing cell model from file.
parent 8c115c69
......@@ -330,8 +330,7 @@ namespace Nektar
// Load each cell model variable
// j=0 and j=1 are for transmembrane or intra/extra-cellular volt.
Vmath::Zero(m_nq, m_cellSol[0], 1);
Vmath::Zero(m_nq, m_cellSol[1], 1);
for(int j = 2; j < m_cellSol.num_elements(); ++j)
for(int j = 1; j < m_cellSol.num_elements(); ++j)
{
// Get the name of the jth variable
varName = GetCellVarName(j);
......@@ -354,7 +353,17 @@ namespace Nektar
// Read the restart file containing this variable
LibUtilities::Import(file, FieldDef, FieldData);
cout << FieldDef[0]->m_fields[j-2] << endl;
LibUtilities::FieldMetaDataMap fieldMetaDataMap;
LibUtilities::FieldMetaDataMap::iterator iter;
LibUtilities::ImportFieldMetaData(file,fieldMetaDataMap);
iter = fieldMetaDataMap.find("Time");
if(iter != fieldMetaDataMap.end())
{
m_lastTime = iter->second;
cout << "Set start time for cell model to " << m_lastTime << endl;
}
// Extract the data into the modal coefficients
for(int i = 0; i < FieldDef.size(); ++i)
{
......
......@@ -147,7 +147,6 @@ namespace Nektar
// Variables
// 0 V membrane potential
// 1 - unused
// 2 m fast sodium current m gate
// 3 h fast sodium current h gate
// 4 j fast sodium current j gate
......@@ -581,27 +580,26 @@ namespace Nektar
switch (idx)
{
case 0: return "u";
case 1: return "v";
case 2: return "m";
case 3: return "h";
case 4: return "j";
case 5: return "o_a";
case 6: return "o_i";
case 7: return "u_a";
case 8: return "u_i";
case 9: return "x_r";
case 10: return "x_s";
case 11: return "d";
case 12: return "f";
case 13: return "f_Ca";
case 14: return "U";
case 15: return "V";
case 16: return "W";
case 17: return "Na_i";
case 18: return "Ca_i";
case 19: return "K_i";
case 20: return "Ca_rel";
case 21: return "Ca_up";
case 1: return "m";
case 2: return "h";
case 3: return "j";
case 4: return "o_a";
case 5: return "o_i";
case 6: return "u_a";
case 7: return "u_i";
case 8: return "x_r";
case 9: return "x_s";
case 10: return "d";
case 11: return "f";
case 12: return "f_Ca";
case 13: return "U";
case 14: return "V";
case 15: return "W";
case 16: return "Na_i";
case 17: return "Ca_i";
case 18: return "K_i";
case 19: return "Ca_rel";
case 20: return "Ca_up";
}
}
......
......@@ -101,7 +101,7 @@ namespace Nektar
// copy Data into FieldData and set variable
std::string varName;
for(int j = 2; j < m_cell->GetNumCellVariables(); ++j)
for(int j = 1; j < m_cell->GetNumCellVariables(); ++j)
{
varName = m_cell->GetCellVarName(j);
......@@ -115,7 +115,12 @@ namespace Nektar
pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], data);
}
}
LibUtilities::Write(vOutputFilename.str(),FieldDef,FieldData);
// Update time in field info if required
LibUtilities::FieldMetaDataMap fieldMetaDataMap;
fieldMetaDataMap["Time"] = time;
LibUtilities::Write(vOutputFilename.str(),FieldDef,FieldData,fieldMetaDataMap);
m_outputIndex++;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment