Ejemplo n.º 1
0
            public void ToFoamDictionary(FoamDictionary dSurfaceRefine)
            {
                FoamDictionary ds = dSurfaceRefine.GetByUrl(RegionName);

                ds.SetChild("surfaceFile", SurfaceFile);
                Parameters.ToFoamDictionary(ds);
            }
Ejemplo n.º 2
0
            public void ToFoamDictionary(FoamDictionary dObjectRefine)
            {
                FoamDictionary dor = dObjectRefine.GetByUrl(Geometry.Name);

                Geometry.ToFoamDictionary(dor);
                Parameters.ToFoamDictionary(dor);
            }
Ejemplo n.º 3
0
            public void ToFoamDictionary(FoamDictionary fp)
            {
                FoamDictionary fpn = fp.GetByUrl(PartName);

                fpn.SetChild("newName", NewName);
                fpn.SetChild("type", "patch");
            }
Ejemplo n.º 4
0
 public void ToFoamDictionary(FoamDictionary dLocalRefine)
 {
     foreach (string pn in PartNames)
     {
         FoamDictionary dpn = dLocalRefine.GetByUrl(pn);
         Parameters.ToFoamDictionary(dpn);
     }
 }
Ejemplo n.º 5
0
 public override void ToFoamDictionary(FoamDictionary fd)
 {
     fd.SetChild("type", "box");
     fd.SetChild("centre", Center.ToString());
     fd.SetChild("lengthX", LengthX);
     fd.SetChild("lengthY", LengthY);
     fd.SetChild("lengthZ", LengthZ);
 }
Ejemplo n.º 6
0
 public override void ToFoamDictionary(FoamDictionary fd)
 {
     fd.SetChild("type", "cone");
     fd.SetChild("p0", Point0.ToString());
     fd.SetChild("p1", Point1.ToString());
     fd.SetChild("radius0", Radius0);
     fd.SetChild("radius1", Radius1);
 }
Ejemplo n.º 7
0
        List <KeyValuePair <string, string> > GetPatchs()
        {
            List <KeyValuePair <string, string> > patches = new List <KeyValuePair <string, string> >();
            FoamDictionaryFile f = new FoamDictionaryFile(boundaryFile, monitor);

            f.Read();
            FoamDictionary d = f.Dictionary.LookupByUrl("");

            return(patches);
        }
Ejemplo n.º 8
0
        public void SetValues(string path, List <EnvironmentItem> values)
        {
            FoamDictionary d = Dict.GetByUrl(path);

            d.Clear();
            foreach (EnvironmentItem p in values)
            {
                d.SetChild(p.Name, p.Value);
            }
            ConfigFile.Write();
        }
Ejemplo n.º 9
0
        public string GetValue(string path, string name, string defaultValue)
        {
            FoamDictionary d = Dict.LookupByUrl(path);

            if (d.IsNull)
            {
                return(defaultValue);
            }
            else
            {
                return(d.Child(name).Data);
            }
        }
Ejemplo n.º 10
0
        public List <EnvironmentItem> GetValues(string path, List <EnvironmentItem> defaultValues)
        {
            List <EnvironmentItem> values = new List <EnvironmentItem>();
            FoamDictionary         d      = Dict.LookupByUrl(path);

            if (d.IsNull)
            {
                return(defaultValues);
            }
            else
            {
                foreach (KeyValuePair <string, FoamDictionary> p in d)
                {
                    values.Add(new EnvironmentItem(p.Key, p.Value.Data));
                }
                return(values);
            }
        }
Ejemplo n.º 11
0
        public void SetBoundaryType(string name, BoundaryType bt)
        {
            FoamDictionaryListFile f = new FoamDictionaryListFile(FoamConst.GetBoundaryFileNameFromVxt(vxtFileName));

            f.Read();
            if (!f.Dictionary.IsNull)
            {
                foreach (KeyValuePair <string, FoamDictionary> k in f.Dictionary)
                {
                    if (k.Key == name)
                    {
                        FoamDictionary cv = k.Value;
                        cv.SetChild("type", bt.ToString());
                        cv.RemoveChild("inGroups");
                    }
                }
            }
            f.Write();
        }
Ejemplo n.º 12
0
        public List <string> GetPatchNamesByType(string typeName)
        {
            List <string>          names = new List <string>();
            FoamDictionaryListFile f     = new FoamDictionaryListFile(FoamConst.GetBoundaryFileNameFromVxt(vxtFileName));

            f.Read();
            if (!f.Dictionary.IsNull)
            {
                foreach (KeyValuePair <string, FoamDictionary> k in f.Dictionary)
                {
                    FoamDictionary cv = k.Value;
                    if (cv.Child("type").Data == typeName)
                    {
                        names.Add(k.Key);
                    }
                }
            }
            return(names);
        }
Ejemplo n.º 13
0
        public bool Write(string foamRootPathName, IMonitor monitor)
        {
            FoamDictionaryFile f = new FoamDictionaryFile(FoamConst.GetFvOptionsPath(foamRootPathName), monitor);

            f.Read();
            var d = f.Dictionary.GetByUrl("options").AddChild(Name);

            d.SetChild("type", "scalarSemiImplicitSource");
            d.SetChild("timeStart", StartTime);
            d.SetChild("duration", Duration);
            d.SetChild("selectionMode", "points");
            FoamDictionary points = new FoamDictionary(true, monitor);

            points.SetChild("0", Location.ToString());
            d.SetChild("points", points);
            d.SetChild("volumeMode", "absolute");
            FoamDictionary injectionRateSuSp = new FoamDictionary(monitor);

            injectionRateSuSp.SetChild("tracer", "(1 0)");
            d.SetChild("injectionRateSuSp", injectionRateSuSp);
            f.Write();
            return(true);
        }
Ejemplo n.º 14
0
        public override bool Write(string foamRootPathName, IMonitor monitor)
        {
            base.Write(foamRootPathName, monitor);
            FoamDictionaryFile controlFile = new FoamDictionaryFile(FoamConst.GetControlDictFileName(foamRootPathName), monitor);

            controlFile.Read();
            FoamDictionary dfun = controlFile.Dictionary.GetByUrl("functions");
            FoamDictionary m    = new FoamDictionary(monitor);

            m.SetChild("type", "probes");
            m.SetChild("functionObjectLibs", "(\"libsampling.dll\")");
            m.SetChild("probeLocations", string.Format("({0})", Location.ToString()));
            FoamDictionary fields = new FoamDictionary(true, monitor);

            foreach (var f in Fields)
            {
                fields.SetChild(f, f);
            }
            m.SetChild("fields", fields);
            dfun.SetChild(Name, m);
            controlFile.Write();
            return(true);
        }
Ejemplo n.º 15
0
 public bool Write(string foamRootPathName, IMonitor monitor = null)
 {
     try
     {
         string             dictFileName = FoamConst.GetCfMeshDictFileName(foamRootPathName);
         FoamDictionaryFile f            = new FoamDictionaryFile(dictFileName, monitor);
         f.Read();
         f.Dictionary.SetChild("surfaceFile", "\"surface.stl\"");
         f.Dictionary.SetChild("maxCellSize", MaxCellSize);
         f.Dictionary.SetChild("minCellSize", MinCellSize);
         f.Dictionary.SetChild("boundaryCellSize", BoundaryCellSize);
         f.Dictionary.SetChild("enforceGeometryConstraints", EnforceGeometryConstraints ? "1" : "0");
         FoamDictionary dLocalRefine = f.Dictionary.GetByUrl("localRefinement");
         dLocalRefine.Clear();
         foreach (LocalRefinementSubDict l in LocalRefine)
         {
             l.ToFoamDictionary(dLocalRefine);
         }
         FoamDictionary dObjectRefine = f.Dictionary.GetByUrl("objectRefinements");
         dObjectRefine.Clear();
         foreach (ObjectRefinementSubDict o in ObjectRefine)
         {
             o.ToFoamDictionary(dObjectRefine);
         }
         FoamDictionary dSurfaceRefine = f.Dictionary.GetByUrl("surfaceMeshRefinement");
         dSurfaceRefine.Clear();
         foreach (SurfaceRefinementSubDict s in SurfaceRefine)
         {
             s.ToFoamDictionary(dSurfaceRefine);
         }
         FoamDictionary dPatchName = f.Dictionary.GetByUrl("renameBoundary");
         dPatchName.Clear();
         dPatchName.SetChild("defaultName", "walls");
         dPatchName.SetChild("defaultType", "wall");
         FoamDictionary dNewPatchNames = dPatchName.GetByUrl("newPatchNames");
         dNewPatchNames.Clear();
         foreach (PatchConfigSubDict p in PatchConfig)
         {
             p.ToFoamDictionary(dNewPatchNames);
         }
         FoamDictionary dBoundaryLayers = f.Dictionary.GetByUrl("boundaryLayers");
         dBoundaryLayers.Clear();
         if (GlobalBoundaryLayerParameters.NLayers != 0)
         {
             GlobalBoundaryLayerParameters.ToFoamDictionary(dBoundaryLayers);
         }
         FoamDictionary dPatchBoundaryLayers = dBoundaryLayers.GetByUrl("patchBoundaryLayers");
         dPatchBoundaryLayers.Clear();
         foreach (PatchBoundaryLayerSubDict p in PatchBoundaryLayerParameters)
         {
             p.ToFoamDictionary(dPatchBoundaryLayers);
         }
         f.Write(dictFileName);
         return(true);
     }
     catch (Exception e)
     {
         if (monitor != null)
         {
             monitor.ErrorLine(e.Message);
         }
         return(false);
     }
 }
Ejemplo n.º 16
0
            public void ToFoamDictionary(FoamDictionary fp)
            {
                FoamDictionary d = fp.GetByUrl(PartName);

                Parameters.ToFoamDictionary(d);
            }
Ejemplo n.º 17
0
 public override void ToFoamDictionary(FoamDictionary fd)
 {
     fd.SetChild("type", "sphere");
     fd.SetChild("centre", Center.ToString());
     fd.SetChild("radius", Radius);
 }
Ejemplo n.º 18
0
 public void ToFoamDictionary(FoamDictionary fp)
 {
     fp.SetChild("nLayers", NLayers);
     fp.SetChild("thicknessRatio", ThicknessRatio);
     fp.SetChild("maxFirstLayerThickness", MaxFirstLayerThickness);
 }
Ejemplo n.º 19
0
 public void ToFoamDictionary(FoamDictionary fo)
 {
     fo.SetChild("additionalRefinementLevels", AdditionalRefinementLevels);
     fo.SetChild("refinementThickness", RefinementThickness);
     fo.SetChild("cellSize", CellSize);
 }