Пример #1
0
    def Initialize(self):
        print("entered in initialization")
        # calculate the normals to the overall domain
        # self.normal_tools.CalculateBodyNormals(self.model_part.Elements,self.domain_size);
        #
        # print "to be removed SOOOOOOOOOOOOOOOOOOOOOOOOOONNNNNNNNNN!!!!!"
        # for node in self.model_part.Nodes:
        # node.SetSolutionStepValue(DIAMETER,0,0.01)

        # look for neighbours on the base mesh
        (self.mesh_neighbour_search).Execute()

        # constructing the fluid solver
        self.solver = monolithic_solver_eulerian.MonolithicSolver(
            self.model_part, self.domain_size)
        self.model_part.ProcessInfo.SetValue(DYNAMIC_TAU, 1.0)
        self.max_iter = 10
        self.solver.Initialize()

        # costruct matrices for convection solver -
        # note that it should be constructed here ONLY
        # if it is fixed during the iterations!!!!!!
        if (self.reform_convection_matrix == False):
            self.convection_solver.ConstructSystem(self.model_part, DISTANCE,
                                                   VELOCITY, MESH_VELOCITY)

        # Initialize distance function
        self.RecalculateDistanceFunction()

        print("finished initialization")
Пример #2
0
min_dt = pfem_var.min_dt
safety_factor = pfem_var.safety_factor
nsteps = pfem_var.nsteps

# creating the solvers
# fluid solver
if (SolverType == "FractionalStep"):
    fluid_solver = incompressible_fluid_solver.IncompressibleFluidSolver(
        fluid_model_part, domain_size)
    fluid_solver.laplacian_form = laplacian_form
    # standard laplacian form
    fluid_solver.predictor_corrector = fluid_only_var.predictor_corrector
    fluid_solver.max_press_its = fluid_only_var.max_press_its
    fluid_solver.Initialize()
elif (SolverType == "monolithic_solver_eulerian"):
    fluid_solver = monolithic_solver_eulerian.MonolithicSolver(
        fluid_model_part, domain_size)
    oss_swith = fluid_only_var.use_oss
    dynamic_tau = fluid_only_var.dynamic_tau
    fluid_model_part.ProcessInfo.SetValue(OSS_SWITCH, oss_swith)
    fluid_model_part.ProcessInfo.SetValue(DYNAMIC_TAU, dynamic_tau)
    fluid_solver.Initialize()
elif (SolverType == "monolithic_solver_lagrangian"):
    fluid_solver = monolithic_solver_lagrangian_contact.MonolithicSolver(
        fluid_model_part, domain_size, box_corner1, box_corner2)
    # fluid_solver.remeshing_flag = False
    oss_swith = pfem_var.use_oss
    dynamic_tau = pfem_var.dynamic_tau
    fluid_model_part.ProcessInfo.SetValue(OSS_SWITCH, oss_swith)
    fluid_model_part.ProcessInfo.SetValue(DYNAMIC_TAU, dynamic_tau)
    fluid_solver.Initialize(output_Dt)
    fluid_solver.remeshing_flag = False
Пример #3
0
    def __init__(self, model_part, domain_size):
        self.model_part = model_part
        self.domain_size = domain_size

        # construct the model part for the convection solver
        if (self.domain_size == 2):
            raise "error, still not implemented in 2D"
            conv_elem = "SUPGConv2D"
            conv_cond = "Condition2D"
        else:
            conv_elem = "SUPGConv3D"
            conv_cond = "Condition3D"
        model = self.model_part.GetModel()
        self.convection_model_part = model.CreateModelPart(
            "convection_model_part")
        self.conv_generator = ConnectivityPreserveModeler()
        (self.conv_generator).GenerateModelPart(self.model_part,
                                                self.convection_model_part,
                                                conv_elem, conv_cond)
        (ParallelFillCommunicator(self.convection_model_part)).Execute()

        # construct the model part for the t solver
        if (self.domain_size == 2):
            conv_elem = "SUPGConvDiff2D"
            conv_cond = "ThermalFace2D"
        else:
            conv_elem = "SUPGConvDiff3D"
            conv_cond = "ThermalFace3D"
        self.thermal_model_part = model.CreateModelPart("thermal_model_part")
        self.conv_generator = ConnectivityPreserveModeler()
        (self.conv_generator).GenerateModelPart(self.model_part,
                                                self.thermal_model_part,
                                                conv_elem, conv_cond)

        # constructing the convection solver for the distance
        self.convection_solver = pureconvection_solver.Solver(
            self.convection_model_part, self.domain_size, distance_settings)
        self.convection_solver.max_iterations = 8

        # constructing the convection solver for the distance
        self.thermal_solver = thermal_solver.Solver(self.thermal_model_part,
                                                    self.domain_size,
                                                    temperature_settings)

        # constructing the fluid solver
        self.fluid_solver = monolithic_solver_eulerian.MonolithicSolver(
            self.model_part, self.domain_size)
        self.vel_criteria = 1e-3
        self.press_criteria = 1e-5
        self.vel_abs_criteria = 1e-9
        self.press_abs_criteria = 1e-9
        self.fluid_solver.ReformDofSetAtEachStep = False

        #
        # properties of the two fluids
        self.rho1 = 1000.0  # applied on the negative part of the domain
        self.conductivity1 = 1.0
        self.specific_heat1 = 1.0

        self.rho2 = 1.0  # applied to the positive part of the domain
        self.conductivity2 = 1.0
        self.specific_heat2 = 1.0

        # common properties for the two fluids
        self.mu = 1.0e-3
        self.ambient_temperature = 293.15  # note that temperatures should be given in Kelvins
        self.mould_temperature = self.ambient_temperature
        self.inlet_temperature = 800.0
        self.convection_coefficient = 0.0
        self.emissivity = 0.0
        #

        if (self.domain_size == 2):
            self.redistance_utils = ParallelDistanceCalculator2D()
        else:
            self.redistance_utils = ParallelDistanceCalculator3D()

        self.max_levels = 50
        self.redistance_frequency = 1
        self.max_edge_size = self.redistance_utils.FindMaximumEdgeSize(
            self.convection_model_part)
        self.max_distance = self.max_edge_size * 3.0

        # assigning the fluid properties
        #        conductivity = 0.0;
        #        density = 1.0;
        #        specific_heat = 1.0;
        #        for node in model_part.Nodes:
        #            node.SetSolutionStepValue(temperature_settings.GetDiffusionVariable(),0,conductivity);
        #            node.SetSolutionStepValue(temperature_settings.GetDensityVariable(),0,density);
        #            node.SetSolutionStepValue(SPECIFIC_HEAT,0,specific_heat);

        self.max_ns_iterations = 8
        self.dynamic_tau = 1.00

        self.divergence_clearance_performed = True  # setting to true it will not perform it

        # create utility to estimate Dt
        self.dt_estimator = EstimateDt3D(self.model_part)

        # utility to set to zero variables
        self.variable_utils = VariableUtils()

        self.internal_step_counter = 0