31 Mar 2014

Free Surface modelling in Simulation CFD 2014

The 2014 release of Autodesk Simulation CFD Advanced/Motion brought with it the ability to simulate free surfaces in liquid volumes.  The applications of this are numerous and range from sloshing in tanks, the path of free flowing water, and hydrodynamic pumps and propulsion.

While the mathematical functions behind it are extremely complex, the setup of free surface is actually very simple.  Here's a quick start guide to getting yourself up and running with a free surface analysis in Sim CFD.  Keep the following image of fluid pouring through a gate in mind for our example.

1) Model only your fluid volumes.  You will need at least 2 distinct solid bodies.  Model a reservoir and a basin, and the gap that they will pass through (the gap can be part of the basin volume).  There's no need to model anything else, since you will only be concerned with flow rather than heat transfer, unless you want to take wall roughness into account.

2) Launch your model into Sim CFD from the tab in Inventor.

3) Apply materials.  All volumes should be the same e.g. water, even the initially empty volumes

4) Skip boundary conditions.  We don't need any boundary conditions for this analysis since it is self-contained i.e. nothing enters or leaves the system.

5) Add an HOF initial condition to the reservoir fluid volume only - set the value to 1.  HOF (height of fluid) is an on/off value (0 or 1) that instructs the application as to which particular fluid volume is filled at the start of the analysis.  Any volumes not designated a height will be seen as empty.

6) Open the Solve dialogue.  
- On the Physics tab, click Free Surface and check the Enable Free Surface box.  Enter your gravity direction, which is usually negative Z (0,0,-1) but your model may vary.
- On the Control tab, the Solution Mode will default to Transient.  You will want to set more save intervals than usual for smooth fluid flow visualisation at the end of your solve.
- Choose a large number of Time Steps (1000+) to Run then click Solve.

7) To visualise the results:  right-click in space and choose Free Surface.  You will then see the HOF value in action throughout the solution.  For planes and ISO surfaces, choose VOF and plot as required.  VOF at 0.5 represents the fluid-gas boundary.


24 Mar 2014

Vault Transmittal - need only the dwfs but the transmittal doesn't give the required information

There's a pack and go tool in Vault that is great for sharing files outside of  vault, that gives options for a complete pack and go of assemblies, and all required parts or just the dwfs and sending these directly to an email. It even includes a tool for automatically creating a transmittal report and attaching that in the zip. The transmittal report is fully customisable to include the information and properties you require.
The only problem is when you create a pack and go and choose to just include dwfs (a common scenario when sending out information), the information in the report just includes the information about the dwfs, not the issue number and status of the main files.
Of course you can create your own custom add in to vault to do this (and even share files over a number of different methods such as directly to Autodesk 360), but that could be time consuming to get the extra 1% functionality required from the pack and go tool.
We have created a workaround to this problem which involves manipulating a generated pack and go zip once it is attached to an email, to strip out everything apart from the pdfs, and dwfs of drawings.
Using the pack and go tool, generate a zip of the models, drawings and dwfs and attach to an email. Building filtering in to the report template to only include information on the required files, and remove the information on spurious additional files. Then run the macro below in outlook to strip out all files except for required dwfs and pdfs.
It's a bit crude and basic, but functional and quickly helps achieve an outcome that overcomes the limitations in the existing functionality.

Public Sub clearzipattachedfile()
If TypeOf Application.ActiveWindow Is Outlook.Inspector Then
      processzip (Application.ActiveInspector.CurrentItem)
End If
End Sub
Private Sub processzip(obj As Outlook.MailItem)
Dim Att As Outlook.Attachment
Dim Path As String
Path = Environ("temp") & "\"
For Each Att In obj.Attachments
        If Right(Att.FileName, 3) = "zip" Then
            Dim tempfile As String
            tempfile = Path & Att.FileName
            'save zip to temp folder
            Att.SaveAsFile (tempfile)
            'remove zip file from email
            'delete files from zip file
            Call deletefilesfromzip(tempfile)
            'add updated zip back to mail
            obj.Attachments.Add (tempfile)
           'delete zip file from temp folder
            VBA.FileSystem.Kill (tempfile)
       End If
End Sub

Private Sub deletefilesfromzip(zipfile As String)
'macro to delete all files in a folder
On Error Resume Next
'extract files to zipfile
Dim filenamefolder As String
filenamefolder = Left(zipfile, Len(zipfile) - 4)
MkDir filenamefolder
Set oApp = CreateObject("Shell.Application")
oApp.NameSpace((filenamefolder)).CopyHere oApp.NameSpace((zipfile)).Items
Set FileSys = CreateObject("Scripting.FileSystemObject")
FileSys.DeleteFile zipfile
Call newzip(zipfile)
Call deletefiles(filenamefolder, zipfile)
FileSys.deletefolder filenamefolder
Set FileSys = Nothing
End Sub

Private Sub deletefiles(foldername, zipname)
Dim FileSys 'As FileSystemObject
Dim objFile 'As vba.File
Dim myFolder
Set FileSys = CreateObject("Scripting.FileSystemObject")
Set myFolder = FileSys.GetFolder(foldername)
For Each subf In myFolder.subfolders
   Call deletefiles(subf.Path, zipname)
Next subf

'loop through each file and check for name match
For Each objFile In myFolder.Files
        If Right(objFile.Name, 7) <> "dwg.dwf" And Right(objFile.Name, 7) <> "idw.dwf" And Right(objFile.Name, 3) <> "pdf" Then
            'add back to zip
            Set oApp = CreateObject("Shell.Application")
            Dim i As Integer
            i = 0
            On Error Resume Next
            i = oApp.NameSpace((zipname)).Items.Count
            oApp.NameSpace((zipname)).CopyHere objFile.Path
            Do Until oApp.NameSpace((zipname)).Items.Count = i + 1
                Application.Wait (Now + TimeValue("0:00:01"))
        Set oApp = Nothing
        End If
Next objFile
Set FileSys = Nothing
Set myFolder = Nothing
End Sub

Private Sub newzip(sPath)
'Create empty Zip File
    If Len(dir(sPath)) > 0 Then Kill sPath
    Open sPath For Output As #1
    Print #1, Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0)
    Close #1
End Sub