def apply(system):

        if type(system.mesh) == uw.mesh._spherical_mesh.FeMesh_Annulus:
            phase = 1.
            curvedBox = CoordSystems.Radial(system.mesh.radialLengths,
                                            system.mesh.angularExtent,
                                            boxDims=((0., 1.),
                                                     (0., 1.))).curved_box
        else:

            def curvedBox(argument):
                return argument

        initialConditions = InitialConditions.Group([
            InitialConditions.Sinusoidal(system.temperatureField.data,
                                         curvedBox(system.mesh.data),
                                         phase=phase,
                                         freq=freq,
                                         pert=pert,
                                         tempRange=(system.surfT,
                                                    system.baseT)),
            InitialConditions.Indices(system.temperatureField.data,
                                      [(system.outer.data, system.surfT),
                                       (system.inner.data, system.baseT)]),
            InitialConditions.SetVal([
                system.velocityField.data, system.pressureField.data,
                system.temperatureDotField.data, system.step.value,
                system.modeltime.value
            ], 0.),
        ])

        initialConditions.apply()
        system.step.value = 0
        system.modeltime.value = 0.
        system.solve()
    def apply(system):

        if type(system.mesh) == uw.mesh._spherical_mesh.FeMesh_Annulus:

            curvedBox = CoordSystems.Radial(
                system.mesh.radialLengths,
                system.mesh.angularExtent,
                boxDims = ((0., 1.), (0., 1.))
                ).curved_box(
                    system.mesh.data
                    )

            initialConditions = InitialConditions.Group([
                InitialConditions.Sinusoidal(system.temperatureField.data, curvedBox, phase = phase + 1.),
                InitialConditions.Indices(
                    system.temperatureField.data,
                    [(system.outer.data, 0.),
                    (system.inner.data, 1.)]
                    ),
                InitialConditions.SetVal(
                    [system.velocityField.data, system.pressureField.data, system.temperatureDotField.data],
                    0.
                    ),
                ])

        else:

            initialConditions = InitialConditions.Group([
                InitialConditions.Sinusoidal(system.temperatureField.data, system.mesh.data, phase = phase),
                InitialConditions.Indices(
                    system.temperatureField.data,
                    [(system.outer.data, 0.),
                    (system.inner.data, 1.)]
                    ),
                InitialConditions.SetVal(
                    [system.velocityField.data, system.pressureField.data, system.temperatureDotField.data],
                    0.
                    ),
                ])

        initialConditions.apply()
        system.solve()
Exemple #3
0
    def apply(system):

        if type(system.mesh) == uw.mesh._spherical_mesh.FeMesh_Annulus:
            phase = 1.
            curvedBox = CoordSystems.Radial(system.mesh.radialLengths,
                                            system.mesh.angularExtent,
                                            boxDims=((0., 1.),
                                                     (0., 1.))).curved_box
        else:

            def curvedBox(argument):
                return argument

        initialConditions = InitialConditions.Group([
            InitialConditions.NoisyGradient(
                system.temperatureField.data,
                curvedBox(system.mesh.data),
                gradient=gradient,
                exponent=exponent,
                smoothness=smoothness,
                randomSeed=randomSeed,
                tempRange=(system.surfT, system.baseT),
            ),
            InitialConditions.Indices(system.temperatureField.data,
                                      [(system.outer.data, system.surfT),
                                       (system.inner.data, system.baseT)]),
            InitialConditions.Extents(
                system.materialVar.data,
                curvedBox(system.swarm.particleCoordinates.data),
                initialExtents=[
                    (0, fn.misc.constant(True)),
                    (1,
                     fn.shape.Polygon(
                         np.array([[
                             cont_centre - cont_width / 2., 1. - cont_thickness
                         ], [cont_centre - cont_width / 2., 1.],
                                   [cont_centre + cont_width / 2., 1.],
                                   [
                                       cont_centre + cont_width / 2.,
                                       1. - cont_thickness
                                   ]]))),
                    #(2, fn.shape.Polygon(np.array([[0., 0.], [0., 0.02], [2., 0.02], [2., 0.]]))),
                ]),
            InitialConditions.SetVal([
                system.velocityField.data, system.pressureField.data,
                system.temperatureDotField.data
            ], 0.),
        ])

        initialConditions.apply()
        system.step.value = 0
        system.modeltime.value = 0.
        system.solve()
Exemple #4
0
    def apply(system):

        curvedBox = CoordSystems.Radial(
            system.mesh.radialLengths,
            system.mesh.angularExtent,
            boxDims=((0., 1.), (0., 1.))).curved_box(system.mesh.data)

        initialConditions = InitialConditions.Group([
            InitialConditions.Sinusoidal(system.temperatureField.data,
                                         curvedBox),
            InitialConditions.Indices(system.temperatureField.data,
                                      [(system.outer.data, 0.),
                                       (system.inner.data, 1.)]),
            InitialConditions.SetVal([
                system.velocityField.data, system.pressureField.data,
                system.temperatureDotField.data
            ], 0.),
        ])

        initialConditions.apply()
        system.solve()
Exemple #5
0
    def apply(system):

        if type(system.mesh) == uw.mesh._spherical_mesh.FeMesh_Annulus:
            phase = 1.
            curvedBox = CoordSystems.Radial(
                system.mesh.radialLengths,
                system.mesh.angularExtent,
                boxDims = ((0., 1.), (0., 1.))
                ).curved_box
        else:
            def curvedBox(argument):
                return argument

        initialConditions = InitialConditions.Group([
            InitialConditions.NoisyGradient(
                system.temperatureField.data,
                curvedBox(system.mesh.data),
                gradient = gradient,
                exponent = exponent,
                smoothness = smoothness,
                randomSeed = randomSeed,
                tempRange = (system.surfT, system.baseT),
                ),
            InitialConditions.Indices(
                system.temperatureField.data,
                [(system.outer.data, system.surfT),
                (system.inner.data, system.baseT)]
                ),
            InitialConditions.SetVal(
                [system.velocityField.data,
                 system.pressureField.data,
                 system.temperatureDotField.data],
                0.
                ),
            ])

        initialConditions.apply()
        system.step.value = 0
        system.modeltime.value = 0.
        system.solve()