Exemplo n.º 1
0
        private SteelFlowProjectFile() : base()
        {
            inletNames  = new List <string>();
            upfaceNames = new List <string>();
            symNames    = new List <string>();
            outletNames = new List <string>();
            wallNames   = new List <string>();

            U       = new FieldFile("U", Dimension.U, new InternalField(new VectorVar(0.0, 0.0, 0.0, true)));
            p       = new FieldFile("p", Dimension.P, new InternalField(new ScalerVar(0, true)));
            k       = new FieldFile("k", Dimension.K, new InternalField(new ScalerVar(0.001, true)));
            nut     = new FieldFile("nut", Dimension.NU, new InternalField(new ScalerVar(0.0, true)));
            epsilon = new FieldFile("epsilon", Dimension.EPSILON, new InternalField(new ScalerVar(0.1, true)));
            this.Fields.AddRange(new FieldFile[] { U, p, k, nut, epsilon });

            TransportProperties.AddPropertie("nu", new ScalerVar(Material.DynamicViscosity / Material.Density, Dimension.NU));
            TurbulenceProperties.Model = new KEpsilon();

            Ddt           ddtSteady          = new Ddt(Ddt.DdtTypes.steadyState);
            Interpolation ipLinear           = new Interpolation(Interpolation.InterpolationTypes.linear);
            Interpolation ipUpwind           = new Interpolation(Interpolation.InterpolationTypes.upwind);
            Grad          gdGaussLinear      = new Grad(Grad.GradTypes.Gauss, ipLinear);
            Grad          gdGaussUpwind      = new Grad(Grad.GradTypes.Gauss, ipUpwind);
            Div           dvGaussUpwind      = new Div(Div.DivTypes.Gauss, ipUpwind);
            Div           dvGaussLinear      = new Div(Div.DivTypes.Gauss, ipLinear);
            SnGrad        sgLimitedCorrected = new SnGrad(SnGrad.SnGradTypes.limited, "corrected 0.33");
            Laplacian     lpGaussLinear      = new Laplacian(Laplacian.LaplacianTypes.Gauss, ipLinear, sgLimitedCorrected);

            FvSchemes.AddDdtSchemes(ddtSteady);
            FvSchemes.AddGradSchemes(gdGaussLinear);
            FvSchemes.AddDivSchemes(dvGaussLinear);
            FvSchemes.AddDivSchemes("div(phi,U)", dvGaussUpwind);
            FvSchemes.AddDivSchemes("div(phi,k)", dvGaussUpwind);
            FvSchemes.AddDivSchemes("div(phi,epsilon)", dvGaussUpwind);
            FvSchemes.AddLaplacianSchemes(lpGaussLinear);
            FvSchemes.AddInterpolationSchemes(ipLinear);
            FvSchemes.AddSnGradSchemes(sgLimitedCorrected);

            Simple simple = new Simple();

            simple.residual.SetResidual("p", 1e-4);
            simple.residual.SetResidual("U", 1e-4);
            simple.residual.SetResidual("\"(k|omega|epsilon)\"", 1e-4);
            FvSolution.Solution = simple;
            FvSolution.Relaxation.AddFieldFactor("p", 0.3);
            FvSolution.Relaxation.AddEquationFactor("U", 0.7);
            FvSolution.Relaxation.AddEquationFactor("\"(k|omega|epsilon).*\"", 0.7);
            GAMG           gamgP     = new GAMG("p", 1e-6, 0.1, Solver.SmootherTypes.GaussSeidel);
            SmootherSolver ssOther   = new SmootherSolver("\"(U|k|omega|epsilon)\"", 1e-5, 0.1, Solver.SmootherTypes.GaussSeidel);
            GAMG           gamgOther = new GAMG("\"(U|k|omega|epsilon)\"", 1e-6, 0.1, Solver.SmootherTypes.GaussSeidel);

            FvSolution.AddSolver(gamgP);
            FvSolution.AddSolver(ssOther);
        }
Exemplo n.º 2
0
 public ProjectFile()
 {
     fields                    = new List <FieldFile>();
     boundaryNames             = new List <string>();
     otherFiles                = new List <FoamFile>();
     controlDict               = new ControlDict();
     transportProperties       = new TransportProperties();
     turbulenceProperties      = new TurbulenceProperties(new KEpsilon());
     material                  = new Material("Steel");
     material.Density          = 6940.0;
     material.DynamicViscosity = 0.006293;
     fvSchemes                 = new FvSchemes();
     fvSolution                = new FvSolution(new OpenCFD.Solutions.Simple());
 }
Exemplo n.º 3
0
        static void test1()
        {
            FieldFile ff = new FieldFile("U");

            ff.Dimensions    = Dimension.U;
            ff.InternalField = new InternalField(new VectorVar(1, 0, 0, true));
            ff.BoundaryField = new BoundaryField();
            ff.BoundaryField.AddBoundary(new FixedValue("in", new VectorVar(1, 0, 0, true)));
            ff.BoundaryField.AddBoundary(new Symmetry("sym"));
            //ff.Write("e:\\hope\\test");

            ControlDict cd = new ControlDict();
            //cd.Write("e:\\hope\\test");

            FvSchemes     fs = new FvSchemes();
            Interpolation i  = new Interpolation(Interpolation.InterpolationTypes.linear);
            Grad          g  = new Grad(Grad.GradTypes.Gauss, i);
            SnGrad        s  = new SnGrad(SnGrad.SnGradTypes.corrected);
            Laplacian     l  = new Laplacian(Laplacian.LaplacianTypes.Gauss, i, s);
            Div           d  = new Div(Div.DivTypes.Gauss, i);

            fs.AddDdtSchemes(new Ddt(Ddt.DdtTypes.steadyState));
            fs.AddGradSchemes(g);
            fs.AddDivSchemes(d);
            fs.AddDivSchemes("div(phi,U)", d);
            fs.AddLaplacianSchemes(l);
            fs.AddInterpolationSchemes(i);
            fs.AddSnGradSchemes(s);
            //fs.Write("e:\\hope\\test");

            FvSolution fsn = new FvSolution(new Simple());
            PBiCG      psu = new PBiCG("U", 0.001, 0.001, PBiCG.Preconditioners.DIC);
            PBiCG      psp = new PBiCG("p", 0.001, 0.001, PBiCG.Preconditioners.DIC);

            fsn.AddSolver(psu);
            fsn.AddSolver(psp);
            fsn.SetFieldRelaxtionFactors("U", 1);
            fsn.SetFieldRelaxtionFactors("U", 0.8);
            //fsn.Write("e:\\hope\\test");
        }