#ifndef RCFD_USER
#define RCFD_USER

#include "udf.h"
#include "rCFD_library.h"

/* (C)  2021
    Stefan Pirker
    Particulate Flow Modelling
    Johannes Kepler University, Linz, Austria
    www.particulate-flow.at
*/


    /* user Names */
    /*************************************************************************************/

#if 1

    /* names of phases */
    enum{
        ph_gas,
        ph_solid,
        
        number_of_phase_names
    };

#endif

    /* user set Dicts */
    /*************************************************************************************/

#if 1

    void user_set_solver_dict(void *handle)
    {
        rcfd_set_dict_property_i(handle, "Solver_Dict", -1, -1, -1, "report_priority", 1);

        rcfd_set_dict_property_r(handle, "Solver_Dict", -1, -1, -1, "global_time_step", (2.0 * 5.0e-3));

        rcfd_set_dict_property_i(handle, "Solver_Dict", -1, -1, -1, "time_steps_per_monitoring_interval", 2);

        rcfd_set_dict_property_i(handle, "Solver_Dict", -1, -1, -1, "number_of_frames", (996 / 2));

		rcfd_set_dict_property_i(handle, "Solver_Dict", -1, -1, -1, "number_of_phases", 2);
		
        rcfd_set_dict_property_i(handle, "Solver_Dict", -1, -1, -1, "calibration_on", 1);

        rcfd_set_dict_property_i(handle, "Solver_Dict", -1, -1, -1, "shifts_from_displacement_fields_on", 1);
		
		rcfd_set_dict_property_r(handle, "Solver_Dict", -1, -1, -1, "vof_cutoff_limit", 1.0e-6);
		
		rcfd_set_dict_property_i(handle, "Solver_Dict", -1, -1, -1, "control_conc_sum_on", 1);
    }

    void user_set_calibration_dict(void *handle)
    {
#if RP_NODE
        rcfd_set_dict_property_i(handle, "Calibration_Dict", -1, -1, -1, "calibration_pruning_on", 0);
		
	    rcfd_set_dict_property_i(handle, "Calibration_Dict", -1, -1, -1, "adapt_weights_by_vof_on", 0);
#endif
    }

    void user_set_phase_dict(void *handle)
    {
#if RP_NODE
        
		rcfd_set_dict_property_i(handle, "Phase_Dict", -1, ph_gas, -1, "number_of_data", 0);

		rcfd_set_dict_property_i(handle, "Phase_Dict", -1, ph_solid, -1, "number_of_data", 2);
		
		rcfd_set_dict_property_r(handle, "Phase_Dict", -1, ph_solid, -1, "density", 1450.0);
		
		rcfd_set_dict_property_r(handle, "Phase_Dict", -1, ph_solid, -1, "vof_max", 0.65);

		rcfd_set_dict_property_i(handle, "Phase_Dict", -1, ph_solid, -1, "hindered_drift_on", 0);	
#endif
    }

    void user_set_rec_dict(void *handle)
    {
        rcfd_set_dict_property_s(handle, "Rec_Dict", -1, -1, -1, "format", "replay_format");
    }

	void user_set_cell_dict(void *handle, const short i_layer)
    {
#if RP_NODE
        fluent_set_cell_dict(handle, i_layer);
#endif
    }

    void user_set_face_dict(void *handle, const short i_layer)
    {
#if RP_NODE
        fluent_set_face_dict(handle, i_layer);
#endif
    }	

#endif

    /* user init */
    /*************************************************************************************/

#if 1

#endif

    /* user accesses Data */
    /*************************************************************************************/

#if 1


#endif

    /* register user functions */
    /*************************************************************************************/

    void user_register_functions(void *handle)
    {
        REGISTER_RCFD_UDF( user_set_solver_dict );
		REGISTER_RCFD_UDF( user_set_calibration_dict );
        REGISTER_RCFD_UDF( user_set_phase_dict );
        REGISTER_RCFD_UDF( user_set_rec_dict );
		
        REGISTER_RCFD_UDF( user_set_cell_dict );
        REGISTER_RCFD_UDF( user_set_face_dict );
    }

#endif
