Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable cmm parameter processing, fix some allocation and reading data… #162

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Code/Source/svFSI/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,9 @@ void EquationParameters::set_values(tinyxml2::XMLElement* eq_elem)
} else if (name == ECGLeadsParameters::xml_element_name_) {
ecg_leads.set_values(item);

} else if (name == VariableWallPropsParameters::xml_element_name_) {
variable_wall_properties.set_values(item);

} else if (item->GetText() != nullptr) {
auto value = item->GetText();

Expand Down
54 changes: 46 additions & 8 deletions Code/Source/svFSI/read_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,7 @@ void read_bc(Simulation* simulation, EquationParameters* eq_params, eqType& lEq,
int iM = lBc.iM;
int iFa = lBc.iFa;
auto& face = com_mod.msh[iM].fa[iFa];
if (face.x.size() == 0) {
face.x.resize(com_mod.nsd, face.nNo);
}
face.x.resize(com_mod.nsd, face.nNo);

int data_series = 0;
vtk_xml::read_vtp_pdata(cTmp, "Displacement", com_mod.nsd, com_mod.nsd, data_series, face);
Expand Down Expand Up @@ -2746,12 +2744,19 @@ void read_visc_model(Simulation* simulation, EquationParameters* eq_params, Doma
// Read CMM variable wall properties from a file.
//
// Modifies:
// com_mod.msh[iM.x - seems to use this as a scatch array.
//
// [NOTE] This is not fully implemented, no tests yet.
// com_mod.msh[iM.x - seems to use this as a scratch array.
//
void read_wall_props_ff(ComMod& com_mod, const std::string& file_name, const int iM, const int iFa)
{
#define n_debug_read_wall_props_ff
#ifdef debug_read_wall_props_ff
DebugMsg dmsg(__func__, com_mod.cm.idcm());
dmsg.banner();
dmsg << "com_mod.cmmInit: " << com_mod.cmmInit;
dmsg << "com_mod.varWallProps.nrows(): " << com_mod.varWallProps.nrows();
dmsg << "com_mod.varWallProps.ncols(): " << com_mod.varWallProps.ncols();
#endif

if (com_mod.cmmInit) {
auto& mesh = com_mod.msh[iM];
mesh.x.resize(1, mesh.gnNo);
Expand All @@ -2760,16 +2765,27 @@ void read_wall_props_ff(ComMod& com_mod, const std::string& file_name, const int
int data_comp = 1;
int data_series = 1;
vtk_xml::read_vtu_pdata(file_name, "Thickness", com_mod.nsd, data_comp, data_series, mesh);

for (int a = 0; a < mesh.gnNo; a++) {
int Ac = mesh.gN[a];
com_mod.varWallProps(0,Ac) = mesh.x(0,a);
}

// Read elasticity modulus
mesh.x = 0.0;
data_comp = 1;
data_series = 1;
#ifdef debug_read_wall_props_ff
dmsg << "read_vtp_pdata Elasticity_modulus ..." << com_mod.cmmInit;
#endif
vtk_xml::read_vtu_pdata(file_name, "Elasticity_modulus", com_mod.nsd, data_comp, data_series, mesh);

#ifdef debug_read_wall_props_ff
dmsg << "Set com_mod.varWallProps ... " << com_mod.cmmInit;
#endif
for (int a = 0; a < mesh.gnNo; a++) {
int Ac = mesh.gN[a];
com_mod.varWallProps(1,Ac) = mesh.x(1,a);
com_mod.varWallProps(1,Ac) = mesh.x(0,a);
}

} else {
Expand All @@ -2780,12 +2796,34 @@ void read_wall_props_ff(ComMod& com_mod, const std::string& file_name, const int
// Read thickness
int data_comp = 1;
int data_series = 0;
#ifdef debug_read_wall_props_ff
dmsg << "read_vtp_pdata Thickness " << " ...";
#endif
vtk_xml::read_vtp_pdata(file_name, "Thickness", com_mod.nsd, data_comp, data_series, face);

#ifdef debug_read_wall_props_ff
dmsg << "Set com_mod.varWallProps(0,Ac) " << " ...";
#endif

for (int a = 0; a < face.nNo; a++) {
int Ac = face.gN[a];
Ac = mesh.gN[Ac];
com_mod.varWallProps(0,Ac) = face.x(0,a);
}

#ifdef debug_read_wall_props_ff
dmsg << "read_vtp_pdata Elasticity_modulus " << "...";
#endif
vtk_xml::read_vtp_pdata(file_name, "Elasticity_modulus", com_mod.nsd, data_comp, data_series, face);

#ifdef debug_read_wall_props_ff
dmsg << "Set com_mod.varWallProps(1,Ac) " << " ...";
#endif

for (int a = 0; a < face.nNo; a++) {
int Ac = face.gN[a];
Ac = mesh.gN[Ac];
com_mod.varWallProps(0,Ac) = face.x(1,a);
com_mod.varWallProps(1,Ac) = face.x(0,a);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion Code/Source/svFSI/set_equation_props.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ SetEquationPropertiesMapType set_equation_props = {
//
auto init_str = eq_params->initialize();
std::transform(init_str.begin(), init_str.end(), init_str.begin(), ::tolower);

if (std::set<std::string>{"inflate", "inf"}.count(init_str) != 0) {
com_mod.pstEq = false;
} else if (std::set<std::string>{"prestress", "prest"}.count(init_str) != 0) {
Expand All @@ -119,7 +120,7 @@ SetEquationPropertiesMapType set_equation_props = {
if (eq_params->variable_wall_properties.defined()) {
com_mod.cmmVarWall = true;

if (com_mod.varWallProps.size() != 0) {
if (com_mod.varWallProps.size() == 0) {
com_mod.varWallProps.resize(2, com_mod.gtnNo);
}

Expand Down