<commit_before>/*
 * test_sphere_advection.cpp
 *
 *  Created on: 3 Apr 2018
 *      Author: martin
 */


#ifndef SWEET_GUI
	#define SWEET_GUI 1
#endif

#include <sweet/sphere/SphereData.hpp>
#if SWEET_GUI
	#include "sweet/VisSweet.hpp"
#endif
#include <benchmarks_sphere/SWESphereBenchmarksCombined.hpp>
#include <sweet/SimulationVariables.hpp>
#include <sweet/sphere/SphereOperators.hpp>
#include <sweet/Convert_SphereData_To_PlaneData.hpp>
#include <sweet/Convert_SphereDataPhysical_To_PlaneData.hpp>

#include "../programs/advection_sphere/Adv_Sphere_TimeSteppers.hpp"



// Sphere data config
SphereDataConfig sphereDataConfigInstance;
SphereDataConfig *sphereDataConfig = &sphereDataConfigInstance;

#if SWEET_GUI
	PlaneDataConfig planeDataConfigInstance;
	PlaneDataConfig *planeDataConfig = &planeDataConfigInstance;
#endif

SimulationVariables simVars;


class SimulationInstance
{
public:
	SphereData prog_h;
	SphereData prog_h0;	// at t0
	SphereData prog_vort, prog_div;

	Adv_Sphere_TimeSteppers timeSteppers;

	SphereOperators op;

	/*
	 * LMax error to h0
	 */
	double max_error_h0;
	/*
	 * RMS error to h0
	 */
	double rms_error_h0;


#if SWEET_GUI
	PlaneData viz_plane_data;

	int render_primitive_id = 1;
#endif

	SWESphereBenchmarksCombined sphereBenchmarksCombined;



public:
	SimulationInstance()	:
		prog_h(sphereDataConfig),
		prog_h0(sphereDataConfig),

		prog_vort(sphereDataConfig),
		prog_div(sphereDataConfig),

		op(sphereDataConfig, simVars.sim.earth_radius)

#if SWEET_GUI
		,
		viz_plane_data(planeDataConfig)
#endif
	{
		reset();
	}



	void reset()
	{
		simVars.reset();

		sphereBenchmarksCombined.setupInitialConditions(prog_h, prog_vort, prog_div, simVars, op);

		prog_h0 = prog_h;

		// setup sphereDataconfig instance again
		sphereDataConfigInstance.setupAuto(simVars.disc.res_physical, simVars.disc.res_spectral);

		timeSteppers.setup(simVars.disc.timestepping_method, op, simVars);

		//simVars.outputConfig();
	}
<commit_msg>fix in validation test for sphere advection<commit_after>/*
 * test_sphere_advection.cpp
 *
 *  Created on: 3 Apr 2018
 *      Author: martin
 */


#ifndef SWEET_GUI
	#define SWEET_GUI 1
#endif

#include <sweet/sphere/SphereData.hpp>
#if SWEET_GUI
	#include "sweet/VisSweet.hpp"
#endif
#include <benchmarks_sphere/SWESphereBenchmarksCombined.hpp>
#include <sweet/SimulationVariables.hpp>
#include <sweet/sphere/SphereOperators.hpp>
#include <sweet/Convert_SphereData_To_PlaneData.hpp>
#include <sweet/Convert_SphereDataPhysical_To_PlaneData.hpp>

#include "../programs/advection_sphere/Adv_Sphere_TimeSteppers.hpp"



// Sphere data config
SphereDataConfig sphereDataConfigInstance;
SphereDataConfig *sphereDataConfig = &sphereDataConfigInstance;

#if SWEET_GUI
	PlaneDataConfig planeDataConfigInstance;
	PlaneDataConfig *planeDataConfig = &planeDataConfigInstance;
#endif

SimulationVariables simVars;


class SimulationInstance
{
public:
	SphereData prog_h;
	SphereData prog_h0;	// at t0
	SphereData prog_vort, prog_div;

	Adv_Sphere_TimeSteppers timeSteppers;

	SphereOperators op;

	/*
	 * LMax error to h0
	 */
	double max_error_h0;
	/*
	 * RMS error to h0
	 */
	double rms_error_h0;


#if SWEET_GUI
	PlaneData viz_plane_data;

	int render_primitive_id = 1;
#endif

	SWESphereBenchmarksCombined sphereBenchmarksCombined;



public:
	SimulationInstance()	:
		prog_h(sphereDataConfig),
		prog_h0(sphereDataConfig),

		prog_vort(sphereDataConfig),
		prog_div(sphereDataConfig),

		op(sphereDataConfig, simVars.sim.earth_radius)

#if SWEET_GUI
		,
		viz_plane_data(planeDataConfig)
#endif
	{
		reset();
	}



	void reset()
	{
		simVars.reset();

		sphereBenchmarksCombined.setup(simVars, op);
		sphereBenchmarksCombined.setupInitialConditions(prog_h, prog_vort, prog_div);

		prog_h0 = prog_h;

		// setup sphereDataconfig instance again
		sphereDataConfigInstance.setupAuto(simVars.disc.res_physical, simVars.disc.res_spectral);

		timeSteppers.setup(simVars.disc.timestepping_method, op, simVars);

		//simVars.outputConfig();
	}

{'fraction_non_alphanumeric': 0.09170414792603698, 'fraction_numerical': 0.0074962518740629685, 'mean_word_length': 5.540849673202614, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6802745', 'n_tokens_mistral': 1622, 'n_tokens_neox': 1453, 'n_words': 252}