[FEM] fix broken Z88 part 4: don't hardcode memory for iterative solvers

- we must not hardcode the number of coincidence vector places
The user must have a chance to change this setting for the iterative solvers according to the Z88 docs.
We use as default the number Z88 uses in its distributed example.
This commit is contained in:
Uwe
2022-03-25 19:28:24 +01:00
parent b4befd14b3
commit cc4578e9ae
7 changed files with 115 additions and 79 deletions

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>452</width>
<height>154</height>
<width>466</width>
<height>173</height>
</rect>
</property>
<property name="windowTitle">
@@ -34,6 +34,71 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gl_z88">
<item row="4" column="2">
<widget class="Gui::PrefSpinBox" name="sb_Z88_MaxGS">
<property name="toolTip">
<string>Maximal places in stiffnes matrix.
You might need to increase this when using the
Cholesky solver and you get the error message
that &quot;MAXGS&quot; needs to be increased.</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>6000000</number>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
<property name="singleStep">
<number>10000000</number>
</property>
<property name="value">
<number>100000000</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>MaxGS</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Fem/Z88</cstring>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="Gui::PrefSpinBox" name="sb_Z88_MaxKOI">
<property name="toolTip">
<string>Maximal places in coincidence vector.
(number of knots per element times
number of finite elements)
You might need to increase this when using an
iterative solver and you get the error message
that &quot;MAXKOI&quot; needs to be increased.</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>50000</number>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
<property name="singleStep">
<number>100000</number>
</property>
<property name="value">
<number>2800000</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>MaxKOI</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Fem/Z88</cstring>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::PrefFileChooser" name="fc_z88_binary_path" native="true">
<property name="enabled">
@@ -90,6 +155,35 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="l_ccx_max_iterations_2">
<property name="text">
<string>Max places in coincidence vector</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="l_z88_binary_path">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>z88r binary path:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="l_ccx_initial_time_step">
<property name="text">
@@ -97,18 +191,12 @@
</property>
</widget>
</item>
<item row="2" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="4" column="0">
<widget class="QLabel" name="l_ccx_max_iterations">
<property name="text">
<string>Max places in stiffnes matrix</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
<item row="3" column="2">
<widget class="Gui::PrefComboBox" name="cmb_solver">
@@ -144,66 +232,6 @@
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="l_z88_binary_path">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>z88r binary path:</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="Gui::PrefSpinBox" name="sb_Z88_MaxGS">
<property name="toolTip">
<string>Maximal places in stiffnes matrix.
You might need to increase this when using the
Colesky solver and you get the error message
that &quot;MAXGS&quot; needs to be increased.</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>6000000</number>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
<property name="singleStep">
<number>10000000</number>
</property>
<property name="value">
<number>100000000</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>MaxGS</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Fem/Z88</cstring>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="l_ccx_max_iterations">
<property name="text">
<string>Max places in stiffnes matrix</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@@ -55,6 +55,8 @@ void DlgSettingsFemZ88Imp::saveSettings()
ui->cmb_solver->onSave();
hGrp->SetInt("MaxGS", ui->sb_Z88_MaxGS->value());
ui->sb_Z88_MaxGS->onSave();
hGrp->SetInt("MaxKOI", ui->sb_Z88_MaxKOI->value());
ui->sb_Z88_MaxKOI->onSave();
}
void DlgSettingsFemZ88Imp::loadSettings()
@@ -72,6 +74,9 @@ void DlgSettingsFemZ88Imp::loadSettings()
int places = hGrp->GetInt("MaxGS", 100000000);
if (places > -1)
ui->sb_Z88_MaxGS->setValue(places);
places = hGrp->GetInt("MaxKOI", 2800000);
if (places > -1)
ui->sb_Z88_MaxKOI->setValue(places);
}
/**

View File

@@ -289,13 +289,16 @@ class FemInputWriterZ88(writerbase.FemInputWriter):
# ********************************************************************************************
def write_z88_memory_parameter(self):
prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Z88")
MaxGS = prefs.GetInt("MaxGS", 100000000)
MaxGS = prefs.GetInt("MaxGS", 100000000)
MaxKOI = prefs.GetInt("MaxKOI", 2800000)
global z88_dyn_template
templateArray = z88_dyn_template.splitlines()
output = ""
for line in templateArray:
if line.find("MAXGS") > -1:
line = " MAXGS " + str(MaxGS)
if line.find("MAXKOI") > -1:
line = " MAXKOI " + str(MaxKOI)
output += line + "\n"
solver_parameter_file_path = self.file_name + ".dyn"
@@ -370,7 +373,7 @@ Common entries for all modules gemeinsame Daten fuer alle Module
COMMON START
MAXGS 100000000
MAXKOI 1200000
MAXKOI 2800000
MAXK 60000
MAXE 300000
MAXNFG 200000

View File

@@ -24,7 +24,7 @@ Common entries for all modules gemeinsame Daten fuer alle Module
COMMON START
MAXGS 100000000
MAXKOI 1200000
MAXKOI 2800000
MAXK 60000
MAXE 300000
MAXNFG 200000

View File

@@ -24,7 +24,7 @@ Common entries for all modules gemeinsame Daten fuer alle Module
COMMON START
MAXGS 100000000
MAXKOI 1200000
MAXKOI 2800000
MAXK 60000
MAXE 300000
MAXNFG 200000

View File

@@ -24,7 +24,7 @@ Common entries for all modules gemeinsame Daten fuer alle Module
COMMON START
MAXGS 100000000
MAXKOI 1200000
MAXKOI 2800000
MAXK 60000
MAXE 300000
MAXNFG 200000

View File

@@ -24,7 +24,7 @@ Common entries for all modules gemeinsame Daten fuer alle Module
COMMON START
MAXGS 100000000
MAXKOI 1200000
MAXKOI 2800000
MAXK 60000
MAXE 300000
MAXNFG 200000