Skip to content
Snippets Groups Projects
Commit bd3a2eff authored by Klaus Böhnlein's avatar Klaus Böhnlein
Browse files

Add Solver_verbosity Option

parent 6f24f4dd
No related branches found
No related tags found
No related merge requests found
......@@ -8,11 +8,11 @@
#path for logfile
#outputPath = "../../outputs/output.txt"
####outputPath = "../../outputs/output.txt"
### Remove/Comment this when running via Python-Script:
outputPath = "../../outputs"
#outputPath = "../../outputs"
......@@ -39,6 +39,7 @@ cellDomain = 1
#numLevels = 1 3 # computes all levels from first to second entry
numLevels = 3 3 # computes all levels from first to second entry
#numLevels = 4 4 # computes all levels from first to second entry
#numLevels = 1 6
......@@ -67,11 +68,8 @@ gamma=1.0
beta = 2.0 # ratio between material parameters mu1 & mu2 .... beta = 1.0 corresponds to homogeneous case
mu1=1.0
lambda1=0.0
#lambda1 = 20.0
#lambda1 = 20.0
#lambda1 = 5.0
#mu1=1000.0
lambda1=10.0
rho1 = 1.0
......@@ -90,8 +88,8 @@ theta = 0.125
material_prestrain_imp= "parametrized_Laminate"
#material_prestrain_imp= "analytical_Example"
#material_prestrain_imp= "parametrized_Laminate"
material_prestrain_imp= "analytical_Example"
#material_prestrain_imp ="isotropic_bilayer"
#material_prestrain_imp= "circle_fiber" #TEST
......@@ -101,7 +99,7 @@ material_prestrain_imp= "parametrized_Laminate"
#write_materialFunctions = true
#write_prestrainFunctions = true # VTK norm of B ,
#write_VTK = true
......@@ -137,6 +135,9 @@ set_IntegralZero = true
Solvertype = 1
Solver_verbosity = 0
#write_corrector_phi1 = false
#write_corrector_phi2 = false
#write_corrector_phi3 = false
......
......@@ -58,7 +58,7 @@
#include <any>
#include <variant>
#include <string>
#include <iomanip>
#include <iomanip> // needed when working with relative paths e.g. from python-scripts
using namespace Dune;
using namespace MatrixOperations;
......@@ -861,7 +861,7 @@ int main(int argc, char *argv[])
// Output setter
// std::string outputPath = parameterSet.get("outputPath", "../../outputs/output.txt");
// std::string outputPath = parameterSet.get("outputPath", "/home/klaus/Desktop/DUNE/dune-microstructure/outputs/output.txt");
std::string outputPath = parameterSet.get("outputPath", "/home/klaus/Desktop/DUNE/dune-microstructure/outputs");
std::string outputPath = parameterSet.get("outputPath", " /home/klaus/Desktop/DUNE/dune-microstructure/outputs");
// std::string MatlabPath = parameterSet.get("MatlabPath", "/home/klaus/Desktop/DUNE/dune-microstructure/Matlab-Programs");
// std::string outputPath = "/home/klaus/Desktop/DUNE/dune-microstructure/outputs/output.txt";
std::fstream log;
......@@ -1015,6 +1015,8 @@ int main(int argc, char *argv[])
///////////////////////////////////
unsigned int Solvertype = parameterSet.get<unsigned int>("Solvertype", 1);
unsigned int Solver_verbosity = parameterSet.get<unsigned int>("Solver_verbosity", 2);
// Print Options
bool print_debug = parameterSet.get<bool>("print_debug", false);
......@@ -1028,6 +1030,8 @@ int main(int argc, char *argv[])
bool write_corrector_phi3 = parameterSet.get<bool>("write_corrector_phi3", false);
bool write_L2Error = parameterSet.get<bool>("write_L2Error", false);
bool write_IntegralMean = parameterSet.get<bool>("write_IntegralMean", false);
bool write_VTK = parameterSet.get<bool>("write_VTK", false);
/////////////////////////////////////////////////////////
// Choose a finite element space for Cell Problem
......@@ -1173,7 +1177,7 @@ int main(int argc, char *argv[])
ilu0, //NULL,
1e-8, // desired residual reduction factorlack
iter, // maximum number of iterations
2); // verbosity of the solver
Solver_verbosity); // verbosity of the solver
InverseOperatorResult statistics;
std::cout << "solve linear system for x_1.\n";
solver.apply(x_1, load_alpha1, statistics);
......@@ -1203,7 +1207,7 @@ int main(int argc, char *argv[])
500, // Number of iterations between restarts,
// here: no restarting
500, // Maximum number of iterations
2); // Verbosity of the solver
Solver_verbosity); // Verbosity of the solver
// Object storing some statistics about the solving process
InverseOperatorResult statistics;
......@@ -1442,6 +1446,7 @@ int main(int argc, char *argv[])
std::cout.precision(10);
std::cout << "q3 : " << std::fixed << q3 << std::endl;
// std::cout<< "q3 : " << q3 << std::endl;
std::cout<< std::fixed << std::setprecision(6) << "q_onetwo=" << Q[0][1] << std::endl;
printvector(std::cout, B_hat, "B_hat", "--");
printvector(std::cout, Beff, "Beff", "--");
......@@ -1491,32 +1496,34 @@ int main(int argc, char *argv[])
double alpha = parameterSet.get<double>("alpha", 2.0);
double p2 = alpha*p1;
std::cout << ((3.0*p1)/2.0)*beta*(1-(theta*(1+alpha))) << std::endl; // TODO ERROR in paper ??
std::cout << "----- print analytic solutions -----" << std::endl;
std::cout << "b1_hat_ana : " << b1_hat_ana << std::endl;
std::cout << "b2_hat_ana : " << b2_hat_ana << std::endl;
std::cout << "b3_hat_ana : " << b3_hat_ana << std::endl;
std::cout << "b1_eff_ana : " << b1_eff_ana << std::endl;
std::cout << "b2_eff_ana : " << b2_eff_ana << std::endl;
std::cout << "b3_eff_ana : " << b3_eff_ana << std::endl;
std::cout << "q1_ana : " << q1_ana << std::endl;
std::cout << "q2_ana : " << q2_ana << std::endl;
std::cout << "q3 should be between q1 and q2" << std::endl;
log << "----- print analytic solutions -----" << std::endl;
log << "b1_hat_ana : " << b1_hat_ana << std::endl;
log << "b2_hat_ana : " << b2_hat_ana << std::endl;
log << "b3_hat_ana : " << b3_hat_ana << std::endl;
log << "b1_eff_ana : " << b1_eff_ana << std::endl;
log << "b2_eff_ana : " << b2_eff_ana << std::endl;
log << "b3_eff_ana : " << b3_eff_ana << std::endl;
log << "q1_ana : " << q1_ana << std::endl;
log << "q2_ana : " << q2_ana << std::endl;
log << "q3 should be between q1 and q2" << std::endl;
if (imp == "analytical_Example") // print Errors only for analytical_Example
{
std::cout << ((3.0*p1)/2.0)*beta*(1-(theta*(1+alpha))) << std::endl; // TODO ERROR in paper ??
std::cout << "----- print analytic solutions -----" << std::endl;
std::cout << "b1_hat_ana : " << b1_hat_ana << std::endl;
std::cout << "b2_hat_ana : " << b2_hat_ana << std::endl;
std::cout << "b3_hat_ana : " << b3_hat_ana << std::endl;
std::cout << "b1_eff_ana : " << b1_eff_ana << std::endl;
std::cout << "b2_eff_ana : " << b2_eff_ana << std::endl;
std::cout << "b3_eff_ana : " << b3_eff_ana << std::endl;
std::cout << "q1_ana : " << q1_ana << std::endl;
std::cout << "q2_ana : " << q2_ana << std::endl;
std::cout << "q3 should be between q1 and q2" << std::endl;
log << "----- print analytic solutions -----" << std::endl;
log << "b1_hat_ana : " << b1_hat_ana << std::endl;
log << "b2_hat_ana : " << b2_hat_ana << std::endl;
log << "b3_hat_ana : " << b3_hat_ana << std::endl;
log << "b1_eff_ana : " << b1_eff_ana << std::endl;
log << "b2_eff_ana : " << b2_eff_ana << std::endl;
log << "b3_eff_ana : " << b3_eff_ana << std::endl;
log << "q1_ana : " << q1_ana << std::endl;
log << "q2_ana : " << q2_ana << std::endl;
log << "q3 should be between q1 and q2" << std::endl;
Storage_Quantities.push_back(std::abs(q1_ana - q1));
Storage_Quantities.push_back(std::abs(q2_ana - q2));
Storage_Quantities.push_back(q3);
......@@ -1609,24 +1616,29 @@ int main(int argc, char *argv[])
//////////////////////////////////////////////////////////////////////////////////////////////
// Write result to VTK file
//////////////////////////////////////////////////////////////////////////////////////////////
std::string vtkOutputName = outputPath + "/CellProblem-result";
VTKWriter<GridView> vtkWriter(gridView_CE);
vtkWriter.addVertexData(
correctorFunction_1,
VTK::FieldInfo("Corrector phi_1 level"+ std::to_string(level) , VTK::FieldInfo::Type::vector, dim));
vtkWriter.addVertexData(
correctorFunction_2,
VTK::FieldInfo("Corrector phi_2 level"+ std::to_string(level) , VTK::FieldInfo::Type::vector, dim));
vtkWriter.addVertexData(
correctorFunction_3,
VTK::FieldInfo("Corrector phi_3 level"+ std::to_string(level) , VTK::FieldInfo::Type::vector, dim));
vtkWriter.write( vtkOutputName + "-level"+ std::to_string(level));
// vtkWriter.pwrite( vtkOutputName + "-level"+ std::to_string(level), outputPath, ""); // TEST Write to folder "/outputs"
// vtkWriter.pwrite( vtkOutputName + "-level"+ std::to_string(level), outputPath, "", VTK::OutputType::ascii, 0, 0 );
std::cout << "wrote data to file: " + vtkOutputName + "-level" + std::to_string(level) << std::endl;
if(write_VTK)
{
std::string vtkOutputName = outputPath + "/CellProblem-result";
std::cout << "vtkOutputName:" << vtkOutputName << std::endl;
VTKWriter<GridView> vtkWriter(gridView_CE);
vtkWriter.addVertexData(
correctorFunction_1,
VTK::FieldInfo("Corrector phi_1 level"+ std::to_string(level) , VTK::FieldInfo::Type::vector, dim));
vtkWriter.addVertexData(
correctorFunction_2,
VTK::FieldInfo("Corrector phi_2 level"+ std::to_string(level) , VTK::FieldInfo::Type::vector, dim));
vtkWriter.addVertexData(
correctorFunction_3,
VTK::FieldInfo("Corrector phi_3 level"+ std::to_string(level) , VTK::FieldInfo::Type::vector, dim));
// vtkWriter.write( vtkOutputName );
vtkWriter.write(vtkOutputName + "-level"+ std::to_string(level));
// vtkWriter.pwrite( vtkOutputName + "-level"+ std::to_string(level), outputPath, ""); // TEST Write to folder "/outputs"
// vtkWriter.pwrite( vtkOutputName + "-level"+ std::to_string(level), outputPath, "", VTK::OutputType::ascii, 0, 0 );
std::cout << "wrote data to file: " + vtkOutputName + "-level" + std::to_string(level) << std::endl;
}
if (write_materialFunctions)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment