Parcourir la source

Div_w computation

Jean Fromentin il y a 1 an
Parent
commit
f002b2f23a

+ 3 - 3
Makefile

@@ -7,7 +7,7 @@ FLAGS 		= -g -O3 -Isrc -Wfatal-errors
 QT_INPUT_FILES	= main_window data input physics time geometry initial_state view tank pump pump_tab cloud clouds_tab
 QT_INPUT_MOC_FILES	= main_window physics input view geometry initial_state tank pump_tab pump cloud clouds_tab
 MATH_INPUT_FILES	= poly3 algo spline
-KERNEL_INPUT_FILES = physics time geometry initial_state source input_data piccard
+KERNEL_INPUT_FILES = physics time geometry initial_state source input_data
 
 QT_OUTPUT_FILES	= main_window solver output_view output
 QT_OUTPUT_MOC_FILES	= main_window solver output
@@ -32,7 +32,7 @@ EXE_INPUT = RichardsFastSlowInput
 EXE_OUTPUT = RichardsFastSlowOutput
 EXE_SOLVER = RichardsFastSlowSolver
 
-all: $(EXE_OUTPUT)
+all: $(EXE_INPUT) $(EXE_OUTPUT) 
 input: $(EXE_INPUT)
 output: $(EXE_OUTPUT)
 solver: $(EXE_SOLVER)
@@ -59,4 +59,4 @@ moc/%.cpp : src/qt/%.hpp
 	$(QT_MOC) $< -o $@
 
 clean:
-	-$(RM) -r $(EXE) moc/input/*.cpp moc/output/*.cpp moc/*.cpp obj/*.o obj/kernel/*.o obj/math/*.o obj/qt/input/*.o obj/qt/output/*.o obj/qt/*.o src/*~ src/qt/*~ src/math/*~ doc/*
+	-$(RM) -r $(EXE) $(EXE_OUTPUT) moc/input/*.cpp moc/output/*.cpp moc/*.cpp obj/*.o obj/kernel/*.o obj/math/*.o obj/qt/input/*.o obj/qt/output/*.o obj/qt/*.o src/*~ src/qt/*~ src/math/*~ doc/*

BIN
inputs/toto.input


+ 2 - 2
src/debug.hpp

@@ -3,8 +3,8 @@
 
 class Debug{
 public:
-  static const int level=1;
-  static const size_t ix=0;
+  static const int level=2;
+  static const size_t ix=51;
 };
 
 #endif

+ 5 - 4
src/kernel/piccard.cpp

@@ -72,8 +72,8 @@ namespace Kernel{
     new_solution->P=all_vertical_richards.P;
 
     size_t k=0;
-    double previous_error=error;
-
+    double previous_error=numeric_limits<double>::infinity();
+    if(Debug::level>1) cout<<"  [Piccard::run] error (horizontal) = \033[31m"<<error<<"\033[0m"<<endl;
     while(error>=tolerence_Piccard and k<max_iterations_Piccard and (abs(previous_error-error)>tolerence_Piccard/100 or error<oscilation_Piccard)){
       previous_error=error;
       error=0;
@@ -81,7 +81,7 @@ namespace Kernel{
       if(Debug::level>1) cout<<"  [Piccard::run] k = "<<k<<endl;
 
       compute_l(l,all_vertical_richards.hsat,error);
-
+  if(Debug::level>1) cout<<"  [Piccard::run] error (l) = \033[31m"<<error<<"\033[0m"<<endl;
       compute_Pl(all_vertical_richards.P);
 
       horizontal_problem.previous_hydr=horizontal_problem.hydr;
@@ -92,6 +92,7 @@ namespace Kernel{
       new_solution->hydr=horizontal_problem.hydr;
 
       error+=horizontal_problem.error;
+      if(Debug::level>1) cout<<"  [Piccard::run] error (l+hydr) = \033[31m"<<error<<"\033[0m"<<endl;
 
       //Compute Overland
       overland.in_hov=previous_solution->hov;
@@ -139,7 +140,7 @@ namespace Kernel{
 
   void
   Piccard::compute_l(double* h,double* hsat,double& error) {
-    bool e=0;
+    double e=0;
     for(size_t ix=0;ix<geometry->nX;++ix){
       double a=h[ix];
       double b=max(hsat[ix],a);

+ 1 - 1
src/kernel/richards.cpp

@@ -61,7 +61,7 @@ namespace Kernel{
   bool
   Richards::weighted_run(double w){
     if(Debug::level>0 and Debug::ix==ix) cout<<"      [Richards::weighted_run] start"<<endl;
-
+    if(Debug::level>0 and Debug::ix==ix) cout<<"      [Richards::weighted_run] w = "<<w<<endl;
     double error=numeric_limits<double>::infinity();
     size_t count=0;
     in_P=near_P;

+ 1 - 1
src/kernel/richards_evolutive_time.cpp

@@ -77,7 +77,7 @@ namespace Kernel{
       if(Debug::level>1){
         cout<<"    [RichardsEvolutiveTime ix="<<ix<<"] out = "<<P<<endl;
         cout<<"    [RichardsEvolutiveTime ix="<<ix<<"]";
-        if(not has_converged) cout<<"not";
+        if(not has_converged) cout<<" not";
         cout<<" converge"<<endl;
       }
       cout<<"    [RichardsEvolutiveTime ix="<<ix<<"] stop"<<endl;

+ 1 - 1
src/kernel/richards_evolutive_time.hpp

@@ -7,7 +7,7 @@
 namespace Kernel{
   class RichardsEvolutiveTime{
   private:
-    static constexpr size_t max_Richards_time_subdivisions=256;
+    static constexpr size_t max_Richards_time_subdivisions=16;//256;
     size_t ix;
     size_t nZ;
     double* Z;

+ 1 - 1
src/qt/input/clouds_tab.hpp

@@ -13,7 +13,7 @@
 #include <QMessageBox>
 
 #include "qt/input/cloud.hpp"
-#include "input_data.hpp"
+#include "kernel/input_data.hpp"
 
 class QtInputCloudsTab:public QWidget{
   Q_OBJECT

+ 1 - 1
src/qt/input/data.hpp

@@ -1,7 +1,7 @@
 #ifndef QT_INPUT_DATA_HPP
 #define QT_INPUT_DATA_HPP
 
-#include "input_data.hpp"
+#include "kernel/input_data.hpp"
 #include "math/spline.hpp"
 
 class QtInputData:public InputData{

+ 1 - 1
src/qt/input/physics.hpp

@@ -16,7 +16,7 @@
 #include <iostream>
 #include <fstream>
 
-#include "../../physics.hpp"
+#include "../../kernel/physics.hpp"
 
 using namespace std;
 

+ 1 - 1
src/qt/input/time.hpp

@@ -10,7 +10,7 @@
 #include <QIntValidator>
 #include <fstream>
 
-#include "../../time.hpp"
+#include "../../kernel/time.hpp"
 
 using namespace std;
 

+ 1 - 1
src/qt/output/main_window.cpp

@@ -1,7 +1,7 @@
 #include "qt/output/main_window.hpp"
 
 QtMainWindow::QtMainWindow():QMainWindow(){
-  string filename="inputs/kernel-2.input";
+  string filename="inputs/toto.input";
   output=new QtOutput(filename);
   setCentralWidget(output);
 }

+ 2 - 3
src/qt/output/solver.cpp

@@ -7,10 +7,9 @@ void
 QtSolver::run(){
   QTime start=QTime::currentTime();
   cout<<"[QtSolver::run] start"<<endl;
-  //  for(size_t i=1;i<Time::nT;++i){
-  for(size_t i=1;i<Time::nT;++i){
+  //for(size_t i=1;i<Time::nT;++i){
     compute_next_solution();
-  }
+  //}
   cout<<"[QtSolver::run] end"<<endl;
   QTime end=QTime::currentTime();
   float ms=start.msecsTo(end);