public void ToFoamDictionary(FoamDictionary fp) { FoamDictionary fpn = fp.GetByUrl(PartName); fpn.SetChild("newName", NewName); fpn.SetChild("type", "patch"); }
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); }
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); }
public void ToFoamDictionary(FoamDictionary dSurfaceRefine) { FoamDictionary ds = dSurfaceRefine.GetByUrl(RegionName); ds.SetChild("surfaceFile", SurfaceFile); Parameters.ToFoamDictionary(ds); }
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(); }
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); }
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(); }
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); }
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); } }
public void ToFoamDictionary(FoamDictionary fp) { fp.SetChild("nLayers", NLayers); fp.SetChild("thicknessRatio", ThicknessRatio); fp.SetChild("maxFirstLayerThickness", MaxFirstLayerThickness); }
public void ToFoamDictionary(FoamDictionary fo) { fo.SetChild("additionalRefinementLevels", AdditionalRefinementLevels); fo.SetChild("refinementThickness", RefinementThickness); fo.SetChild("cellSize", CellSize); }
public override void ToFoamDictionary(FoamDictionary fd) { fd.SetChild("type", "sphere"); fd.SetChild("centre", Center.ToString()); fd.SetChild("radius", Radius); }