root/src/linHeat_algo.h

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. linHeat_algo

   1 /*! \file linHeat_algo.h
   2 
   3     \brief <Program Name>
   4 
   5      Revision history:
   6 
   7           Revised by Christian Power dd.mm.yyyy
   8           Originally written by Christian Power
   9                (power22c@gmail.com) Februar 2016
  10 
  11      Standard routine for an linear parabolic esfem on a stationary surface.
  12      For a new experiment you have to modify:
  13       - io_parameter.cpp
  14       - secOrd_op_rhs.cpp
  15       - secOrd_op_initData.cpp
  16      If you indent to use a new parabolic operator, then you have to create 
  17      a new secOrd_op_XXX.{h.cpp} file and include it in secOrd_op.h.
  18 
  19      Created by Christian Power on 03.02.2016
  20      Copyright (c) 2016 Christian Power.  All rights reserved.
  21  */
  22 
  23 #ifndef LINHEAT_ALGO_H
  24 #define LINHEAT_ALGO_H 
  25 
  26 #include <config.h>
  27 // #include <dune/fem/solver/cginverseoperator.hh>
  28 // #include <dune/fem/solver/oemsolver.hh>
  29 // #include <dune/fem/quadrature/quadrature.hh>
  30 // #include <dune/common/fmatrix.hh>
  31 #include "esfem.h"
  32 
  33 void linHeat_algo(int argc, char** argv){
  34   using namespace Esfem;
  35   
  36   Dune::Fem::MPIManager::initialize(argc, argv);
  37 
  38   const auto parameter_file =
  39     "/Users/christianpower/cpp/DISS_surfaces/data/tumor_parameter.txt";  
  40   Io::Parameter data {argc, argv, parameter_file};
  41 #ifdef DEBUG
  42   std::clog << data << std::endl;
  43 #endif
  44 
  45   Grid::Grid_and_time grid {data};
  46   Grid::Scal_FEfun exact_solution {"exact_solution", grid};
  47   Grid::Scal_FEfun numerical_solution {"numerical_solution", grid};
  48   Grid::Scal_FEfun tmp_fef {"tmp", grid};
  49   
  50   SecOrd_op::Init_data init_data {grid};
  51   SecOrd_op::Rhs rhs {grid};
  52   SecOrd_op::Linear_heat solver {data, grid};
  53   
  54   const Io::L2H1_calculator err_cal {grid, exact_solution, numerical_solution};
  55   Io::Error_stream err_log {data};
  56   err_log << std::scientific;
  57   Io::Paraview paraview_plot {data, grid, exact_solution, numerical_solution};
  58   
  59   init_data.interpolate(numerical_solution);
  60   init_data.interpolate(exact_solution);
  61   solver.mass_matrix(numerical_solution, tmp_fef);
  62 
  63   err_log << data.global_timeStep() << ' '
  64           << err_cal.l2_err() << ' ' << err_cal.h1_err() << std::endl;
  65   // paraview_plot.write();
  66   
  67   grid.next_timeStep(data.global_timeStep());
  68   for(long it =0; it < data.max_timeSteps(); ++it){
  69     // Mu^n+1 + tau Au^n+1 = M^n + tau f^n+1
  70     
  71     rhs.assemble_and_addScaled_to(tmp_fef);
  72     solver.solve(tmp_fef, numerical_solution);
  73     solver.mass_matrix(numerical_solution, tmp_fef);
  74 
  75     init_data.interpolate(exact_solution);
  76     err_log << data.global_timeStep() << ' '
  77             << err_cal.l2_err() << ' ' << err_cal.h1_err() << std::endl;
  78     // paraview_plot.write();
  79     
  80     grid.next_timeStep(data.global_timeStep());
  81   }
  82 }
  83 
  84 #endif // LINHEAT_ALGO_H
  85 
  86 /*! Log:
  87  */

/* [<][>][^][v][top][bottom][index][help] */