/** * @file order1.cpp * @author Olivier Delestre (2008) * @author Christian Laguerre (2012-2015) * @version 1.07.01 * @date 2017-01-05 * * @brief Order 1 scheme * @details * Numerical scheme: at order 1. * * @copyright License Cecill-V2 \n * * * (c) CNRS - Universite d'Orleans - BRGM (France) */ /* * * This file is part of FullSWOF_2D software. * * * FullSWOF_2D = Full Shallow-Water equations for Overland Flow, * in two dimensions of space. * This software is a computer program whose purpose is to compute * solutions for 2D Shallow-Water equations. * * LICENSE * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, * modify and/ or redistribute the software under the terms of the CeCILL * license as circulated by CEA, CNRS and INRIA at the following URL * . * * As a counterpart to the access to the source code and rights to copy, * modify and redistribute granted by the license, users are provided only * with a limited warranty and the software's author, the holder of the * economic rights, and the successive licensors have only limited * liability. * * In this respect, the user's attention is drawn to the risks associated * with loading, using, modifying and/or developing or reproducing the * software by the user in light of its specific status of free software, * that may mean that it is complicated to manipulate, and that also * therefore means that it is reserved for developers and experienced * professionals having in-depth computer knowledge. Users are therefore * encouraged to load and test the software's suitability as regards their * requirements in conditions enabling the security of their systems and/or * data to be ensured and, more generally, to use and operate it in the * same conditions as regards security. * * The fact that you are presently reading this means that you have had * knowledge of the CeCILL license and that you accept its terms. * ******************************************************************************/ #include "order1.hpp" Order1::Order1(Parameters & par):Scheme(par) { /** * @details * @param[in] par parameter, contains all the values from the parameters file. */ } void Order1::calcul() { /** * @details Performs the first order numerical scheme. * @note In DEBUG mode, the programme will save four other files with boundary fluxes and volumes of water. * @warning order1: WARNING: the computation finished because the maximum number of time steps was reached (see MAX_ITER in misc.hpp) */ //boundary conditions boundary(h,u,v,cur_time,NXCELL,NYCELL); //initialization delz and delzc for (int i=1 ; i<=NXCELL+1 ; i++){ for (int j=1 ; j<=NYCELL ; j++){ delz1[i-1][j] = z[i][j]-z[i-1][j]; } //end for j } //end for i for (int i=1 ; i<=NXCELL ; i++){ for (int j=1 ; j<=NYCELL+1 ; j++){ delz2[i][j-1] = z[i][j]-z[i][j-1]; } //end for j } //end for i for (int i=1 ; i<=NXCELL ; i++){ for (int j=1 ; j<=NYCELL ; j++){ delzc2[i][j] = 0.; delzc1[i][j] = 0.; } } time(&start); //time iteration's beginning while (T > cur_time && n < MAX_ITER+1){ // save the data in huz_evolution.dat if (cur_time >= T_output){ out->write(h,u,v,z,cur_time); T_output+=dt_output; }// end if /* save specific points */ out_specific_points->save(h,u,v,cur_time); dt1=dt_max; //boundary conditions boundary(h,u,v,cur_time,NXCELL,NYCELL); for (int i=1 ; icheck_vol(cur_time,dt1,Volrain_Tot,Vol_inf_tot_cumul,Vol_of_tot,Total_volume_outflow); #endif //Displays the percentage of elapsed time cout << '\r' << '\t' << "[" << int((cur_time/T)*100) << "%] done" ; } //end for n : loop in time //Verifies the reason why the run finished if (n>MAX_ITER){ cerr << "\n order1: WARNING: the computation finished because the maximum number of time steps was reached (see MAX_ITER in misc.hpp)\n"; } //Saves the last results out->write(h,u,v,z,cur_time); /* save the last for specific points */ out_specific_points->save(h,u,v,cur_time); //to give the computing time time(&end); timecomputation=difftime(end,start); cpu_time = clock(); //to inform about the froude number Fr=froude_number(hs,us,vs); // The quantity of water outflow is the sum of flux at the boundary multiply by one cell area, so //Outflow volum = (fluxy0_cum_T+fluxNycell_cum_T+fluxx0_cum_T+fluxNxcell_cum_T)*DX*DY //In this case n1=1 and n2=-1 because we consider the direction of the flow // is from left to the right (x=0 to x=Nxcell) and from bottom to the top (y=0 to y=NYCELL) out->result(timecomputation,cpu_time,Volrain_Tot,Vol_inf_tot_cumul , Vol_of_tot,Fr,n,Total_volume_outflow); //storage of h u v value in the final time out->final(z, h, u,v); } Order1::~Order1(){ }