Esempio n. 1
0
    def test_add_missing_parameters(self):
        # only missing parameters are added, no complaints if there already exist more than in the defaults
        kp = Parameters(json_string)
        tmp = Parameters(incomplete_with_extra_parameter)

        kp.AddMissingParameters(tmp)

        self.assertEqual(kp["new_default_obj"]["aaa"].GetString(), "string")
        self.assertEqual(kp["string_value"].GetString(), "hello")
        self.assertFalse(kp["level1"].Has("new_sublevel"))
Esempio n. 2
0
    def GetDefaultParameters(cls):
        # default settings string in json format
        default_settings = Parameters("""{
        "echo_level" : 1,

        "gravity_parameters" : {
            "modulus" : 9.81,
            "direction" : [0.0, 0.0, -1.0]
        },

        "time_stepping" : {
            "automatic_time_step" : true,
            "time_step" : 0.001
        },

        "problem_data"  : {
            "problem_name"  : "",
            "echo_level" : 1,
            "start_time" : 0.0,
            "end_time"   : 1,
            "parallel_type": "OpenMP",
            "number_of_threads": 1
        },

        "ElementType" : "SwimmingDEMElement",
        "body_force_per_unit_mass_variable_name" : "BODY_FORCE",
        "do_print_results_option" : true,
        "output_interval" : 0.5,

        "processes" : {},

        "coupling" : {
            "coupling_level_type" : 1,
            "coupling_weighing_type" : 2,
            "coupling_weighing_type_comment" : "{fluid_to_DEM, DEM_to_fluid, fluid_fraction} = {lin, lin, imposed} (-1), {lin, const, const} (0), {lin, lin, const} (1), {lin, lin, lin} (2), averaging method (3)",
            "interaction_start_time" : 0.0,

            "forward_coupling" : {},

            "backward_coupling" : {}
        },

        "frame_of_reference" : {},

        "non_newtonian_fluid" : {},

        "similarity" : {},

        "stationarity" : {},

        "debug_tool_cycle" : 10,
        "debug_tool_cycle_comment" : " number of 'ticks' per debug computations cycle",
        "print_debug_info_option" : false,
        "print_debug_info_option_comment" : " print a summary of global physical measures",
        "do_process_analytic_data" : true,
        "fluid_domain_volume" : 1.0,
        "fluid_domain_volume_comment" : "write down the volume you know it has, if available",

        "full_particle_history_watcher" : "Empty",


        "gradient_calculation_type" : 1,
        "gradient_calculation_type_comment" : "(Not calculated (0), volume-weighed average(1), Superconvergent recovery(2))",
        "material_acceleration_calculation_type" : 1,
        "laplacian_calculation_type" : 0,
        "laplacian_calculation_type_comment" : "(Not calculated (0), Finite element projection (1), Superconvergent recovery(2))",
        "vorticity_calculation_type" : 5,
        "store_full_gradient_option" : false,
        "add_each_hydro_force_option" : true,
        "add_each_hydro_force_option_comment" : " add each of the hydrodynamic forces (drag, lift and virtual mass)",
        "pressure_grad_recovery_type" : 0,
        "recovery_echo_level" : 1,
        "store_fluid_pressure_option" : false,

        "print_distance_option" : false,
        "print_steps_per_plot_step" : 1,
        "print_particles_results_option" : false,
        "make_results_directories_option" : true,
        "make_results_directories_option_comment": "results are written into a folder (../results) inside the problem folder",
        "print_particles_results_cycle" : 1,
        "print_particles_results_cycle_comment" : " number of 'ticks' per printing cycle",

        "drag_modifier_type" : 2,
        "drag_modifier_type_comment" : " Hayder (2), Chien (3)",

        "json_output_process" : [],
        "sdem_output_processes" : {},
        "properties": [{}],

        "fluid_parameters" : {},

        "custom_fluid" : {},

        "dem_parameters" : {},

        "custom_dem" : {},

        "dem_nodal_results" : {},

        "fluid_nodal_results" : {}

        }""")

        default_settings.AddMissingParameters(super().GetDefaultParameters())
        return default_settings