50 "Writes a Fld file."),
53 "Writes a Fld file."),
67 string filename =
m_config[
"outfile"].as<
string>();
69 if (
m_f->m_writeBndFld)
76 for (
int i = 0; i <
m_f->m_exp.size(); ++i)
78 m_f->m_exp[i]->FillBndCondFromField();
84 cout <<
"OutputFld: Writing boundary file(s): ";
85 for(
int i = 0; i <
m_f->m_bndRegionsToWrite.size(); ++i)
87 if(i < m_f->m_bndRegionsToWrite.size()-1)
95 int nfields =
m_f->m_exp.size();
96 Array<OneD, Array<OneD, const MultiRegions::ExpListSharedPtr> >
98 for (
int i = 0; i < nfields; ++i)
100 BndExp[i] =
m_f->m_exp[i]->GetBndCondExpansions();
106 m_f->m_exp[0]->GetGraph());
109 SpatialDomains::BoundaryRegionCollection::const_iterator breg_it;
110 map<int,int> BndRegionMap;
112 for(breg_it = bregions.begin(); breg_it != bregions.end();
115 BndRegionMap[breg_it->first] = cnt;
119 int dot = filename.find_last_of(
'.') + 1;
120 string ext = filename.substr(dot, filename.length() - dot);
121 string name = filename.substr(0, dot-1);
124 m_f->m_session->GetBndRegionOrdering();
126 for(
int i = 0; i <
m_f->m_bndRegionsToWrite.size(); ++i)
128 string outname = name +
"_b"
129 + boost::lexical_cast<
string>(
m_f->m_bndRegionsToWrite[i])
132 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
133 std::vector<std::vector<NekDouble> > FieldData;
135 if(BndRegionMap.count(
m_f->m_bndRegionsToWrite[i]) == 1)
137 int Border = BndRegionMap[
m_f->m_bndRegionsToWrite[i]];
139 FieldDef = BndExp[0][Border]->GetFieldDefinitions();
140 FieldData.resize(FieldDef.size());
142 for (
int j = 0; j < nfields; ++j)
144 for (
int k = 0; k < FieldDef.size(); ++k)
146 BndExp[j][Border]->AppendFieldData(FieldDef[k],
149 FieldDef[k]->m_fields.push_back(
m_f->m_fielddef[0]->
155 if (vm.count(
"error"))
157 int rank =
m_f->m_session->GetComm()->GetRank();
159 for (
int j = 0; j < nfields; ++j)
161 BndExp[j][Border]->BwdTrans(BndExp[j][Border]->GetCoeffs(),
162 BndExp[j][Border]->UpdatePhys());
168 ->L2(BndExp[j][Border]->GetPhys());
171 ->Linf(BndExp[j][Border]->GetPhys());
175 cout <<
"L 2 error (variable "
176 << FieldDef[0]->m_fields[j]
177 <<
") : " << l2err << endl;
179 cout <<
"L inf error (variable "
180 << FieldDef[0]->m_fields[j]
181 <<
") : " << linferr << endl;
187 m_f->m_fld->Write(outname, FieldDef, FieldData);
195 cout <<
"OutputFld: Writing file..." << endl;
199 m_f->m_fld->Write(filename,
m_f->m_fielddef,
m_f->m_data);
203 if (vm.count(
"error"))
205 int rank =
m_f->m_session->GetComm()->GetRank();
207 for (
int j = 0; j <
m_f->m_exp.size(); ++j)
209 if (
m_f->m_exp[j]->GetPhysState() ==
false)
211 m_f->m_exp[j]->BwdTrans(
212 m_f->m_exp[j]->GetCoeffs(),
213 m_f->m_exp[j]->UpdatePhys());
217 m_f->m_exp[j]->GetPhys());
220 m_f->m_exp[j]->GetPhys());
223 cout <<
"L 2 error (variable "
224 <<
m_f->m_fielddef[0]->m_fields[j]
225 <<
") : " << l2err << endl;
227 cout <<
"L inf error (variable "
228 <<
m_f->m_fielddef[0]->m_fields[j]
229 <<
") : " << linferr << endl;