Monday 6 April 2015

Record Power DML305 midi lathe review

I bought the Record Power DML305 lathe recently and would like to share here some facts with you. All in all I like the machine very much and can clearly recommend it. I have never had a lathe before, so I'm not able to give you a very objective opinion. I didn't discover any bad surprises in functionality or built quality.
The lathe is very silent and makes less noise (idle) than any other woodworking tools I have. With nearly 40 kg it's a sturdy piece of tool. 


The M33 mount version has a "native" thread and no adapter on a smaller thread. The Morse taper is #2 as in the tailstock. MT2 is a very common size with a bigger variety of tools than MT1.


The centers are perfectly aligned in both horizontal and vertical direction (at least for woodturning scales). The lathe doesn't vibrate when running idle.


The main lock works in both directions. This avoids collisions with the lock for the tool rest height. All the other handles are angle-adjustable and you can turn them away from you for comfortable and safe operation.


 The heavy cast iron bed is finished where necessary. The tailstock moves smoothly over the bed.

 

Dimensions


The size of the machine was an important factor for me sine my hobby "chamber" is quite small. The DML305 is very compact with storage dimensions of about 82 x 40 x 25 cm (W x H x D). In operation some more lateral space is needed. The belt change door needs roughly 30 cm when fully open.


The tailstock extends about 18 cm over the bed at full capacity. It can be removed quickly when working on boxes or bowls.


 You will need at least 100 cm of space to operate the lathe.
 

The indexing lock can arrest the spindle at 12 positions. I use it only for fixing and releasing the chuck. The lock can be removed for storage.
With a depth of about 25 cm the lathe can be stored in a shelf when not in use. Removing the tool caddy attached to the back will give 1-2 cm less depth.


Capacity


The maximum distance between the driving center and the revolving center shipped with the DML305 is 405 mm. The 393 mm in the official documentation is a conservative specification (=15 inch). The maximum diameter of the workpiece is 305 mm. Please note, the axial dimensions will be reduced after installing a chuck by 5-6 cm. A drill chuck in the tailstock will need another 6-12 cm. 


The tool rest dimensions match the lathe dimensions well and are enough for the biggest diameter. I never turned such big pieces on the lathe so I can't tell you if the construction is sturdy enough for vibration free operation.


The supplied face plate has a diameter of 83 mm and four holes for mounting wood for bowls.

 

Motor and gears


The lathe has six manually changed gears. Changing gears takes about 30 s and is easier than expected. You just have to learn the trick: Unlock the tensioner, use one hand as a derailleur like in a bicycle gear shift, use the other one to rotate the belt. Big to small wheel change comes first. The slowest speed is 360 rpm. At this speed you can safely turn any unbalanced piece of wood, very convenient. The maximum speed is 3250 rpm. Quite frightening with a big chuck on the spindle.
The motor power of 375 W seems not very high, but I never experienced the need for more power, at least with wood diameters <15 cm. The good thing about belt gears is the constant power. When speed reduces, the torque rises. The motor becomes quite hot during operation. There is even a small label stating that.

 

Tailstock


The tailstock has a Morse taper #2 (MT2). Some web sites list an MT1. The M33 and the 3/4" version might have different taper sizes. Check the diameters before you order accessories. The tailstock spindle can be locked, but I never used this feature up to now. The travel distance of the tail spindle is about 62 mm. It has a marking in inch. Centimeters would be great...


The tailstock of the DML305 has a through-hole for knocking out the mounted tools or drilling long holes.


Knocking out tools is usually not necessary. They are pressed out by cranking the spindle back to the bottom position. I don't know if this trick is in the specs of the Morse taper or just a side effect. Anyway, it's practical.

 

 Accessories


Record Powers offers several accessories in cooperation with other manufactures. I bought the Teknatool Supernova 2 chuck set which fits the machine well. It's a little bit heavy for a midi lathe but a pleasure to work with. The drill chuck from Record Power is very compact, but I went for a keyless version from Paulimot (DE). The keyless chucks are longer.

 

Not so great...


There are two things in the machine that are obviously a bad solution. The belt change door is locked with a simple Allan screw. Each time you need to change the gear you need to grab the hex key and loosen the screw on the left hand side. Unless you are a lefty, it's rather inconvenient and takes time. The user is tempted to run the wrong speed. I replaced the screw with a knob. This knob should become the fist turning exercise. A clamp would be the best solution.


I didn't like the power switch covered with a pseudo emergency button. Should this cover stop kids from playing with the machine? I don't know, but I removed the cover quite quickly. You can lever it out from the hinge easily. With the cover you have no quick access to the OFF button.


Both issues smell a little bit like safety regulations artefacts. Dear customer, it's a toilet brush, don't brush your teeth with it...
The last thing worth mentioning is the motor suspension. The engineer in you will tell you immediately that the motor should not hang on one side like in the picture below. In my DML305 I had to tighten one screw holding the motor assembly (inside the bed) and the problem was solved. Just observe the motor angle after setting up the lathe for the first time.


All cons described here are no real show stoppers and easy to improve.

 

Verdict


Every review needs a verdict;)  The novice says: Yes, go for this lathe. It's compact, silent, heavy and well finished. No bad surprises, as often experienced with cheaper tools. You will not need a barn for it, which is an important factor for the amateur.
It's in the upper price range of the cheapos (2015). The question I can't answer is, if the cheaper machines offer the same value. Compared to it's competitors it has a slightly bigger swing and the slow 360 rpm gear. The latter seems more important to me. You can buy a bed extension if more axial capacity is needed, but there is no "swing extension".
There is also the Record Power DML305VS variable speed version for at least double the price of the fixed speed version. I hope the extra money goes into something else than just  a couple of semiconductors. The different tailstock of the VS suggests that. 

Just for clarification: Although "Record Power" sounds like "Glowing Dragon" or "Top Performance", the negative connotation with disposable drill sets from the supermarket is wrong;)

Happy turning,
Luk


PS: Let me know if you have questions. I will add the data to the article. I would be very happy if someone translates the metric dimensions into imperial units with all the fractions.

Sunday 27 April 2014

TubeNetRadio - The Raspberry Pi powered tube radio


This Sachsenwerk Olympia 59-3W from 1959 learned to play web radio and mp3s


No drilling required - Minimally invasive connection of the Raspberry to the tube radio


This post describes how to setup your Raspberry Pi to work as a web radio and an mp3 player based on mpd and Arch Linux. This description is a part of the TubeNetRadio project described in more detail under www.doc-diy.net/electronics/tubenetradio. In this project the Raspberry Pi is embedded in an old tube radio to add an internet radio and mp3 player functionality.
The user interface consists of just to buttons mounted in the back plate to avoid destroying the original look of the old radio. One button allows to step through radio stations stored in a file. The other one allows you to skip album-wise though your mp3 collection stored locally or remotely. In the following, the essential steps of the software setup are described. The hardware side is described under www.doc-diy.net/electronics/tubenetradio.

Main installation steps

  • Installation of Arch and Python
  • Installation of mpd/mpc
  • The buttons and the player function
  • The start script
The idea behind Arch is to have a thin and fast booting operating system. The price to pay is that you need more steps for the setup than for example with Raspbian. Some packages are just not available off-the-shelf. Since one of the targets was to beat down the boot time close to the tube heat up time of the radio, Arch Linux was the perfect choice.

Copy a fresh Arch image on the SD card. At the time of writing this was
ArchLinuxARM-2014.01-rpi. Configure and update your system. Arch lacks pretty much everything at the beginning. Follow one of the tutorials on the net.

Install base-devel for gcc and others. You will need it to compile the python-pip tool which in turn installs the RPi.GPIO.
pacman -Sy base-devel
Install python2. Because python 3 and 2 are not compatible, the packages are split. The old python 2 is marked with a 2, the new version has no marking
pacman -S python2 python2-pip
Install mpd along with the Python interface using
pacman -S mpd mpc
pacman -S python2-mpd
Important: In Jan 2014 python-mpd doesn't exist! Only the python2 version exists. This is the reason why you have to install the python2 stuff and not the new one. This will probably change soon.

To read out the buttons needed for the user interface you have to install RPi.GPIO by typing
python2-pip RPi.GPIO
RPi.GPIO is a comfortable Python interface to the GPIO connector on the Raspi board.

Starting mpd

Compared to Ubuntu, things turned out to be more complicated. I took me quite a time to sort out all the groups and user settings, including adding group read permissions for /home/pi. In case of trouble, I recommend to set up mpd on a linux PC and try to copy the settings of a working system.

Have a look at this guide:
https://wiki.archlinux.org/index.php/Music_Player_Daemon#Starting_mpd_as_a_user
https://wiki.archlinux.de/title/Music_Player_Daemon

Worth reading is also this:
http://crunchbang.org/forums/viewtopic.php?pid=182574

Use the following listing of the home folder as reference. The user and the group of each file are specified in brackets (generated with tree -uga). Although alternative and better settings probably exist, the following proved to work for me.
[pi@alarmpi ~]$ tree -u -g -a
.
├── [pi       users   ]  .bash_history
├── [pi       users   ]  .bash_logout
├── [pi       users   ]  .bash_profile
├── [pi       users   ]  .bashrc
├── [mpd      audio   ]  .mpd
│   ├── [mpd      audio   ]  database
│   ├── [mpd      mpd     ]  log
│   ├── [mpd      mpd     ]  pid
│   ├── [mpd      mpd     ]  state
│   └── [mpd      audio   ]  sticker.sql
├── [root     root    ]  lastradiopos
├── [root     root    ]  lastsongpos
├── [pi       audio   ]  music
│   ├── [pi       users   ]  Dive Deep
│   │   ├── [pi       users   ]  01 - Morcheeba - Enjoy the Ride (ft Judy Tzuke).mp3
│   │   ├── [pi       users   ]  02 - Morcheeba - Riverbed (ft Thomas Dybdahl).mp3
│   │   ├── [pi       users   ]  03 - Morcheeba - Thumbnails.mp3
│   │   ├── [pi       users   ]  04 - Morcheeba - Run Honey Run (ft Bradley).mp3
│   ├── [pi       users   ]  Love Deluxe
│   │   ├── [pi       users   ]  01 - Sade - No Ordinary Love.mp3
│   │   ├── [pi       users   ]  02 - Sade - Feel No Pain.mp3
│   │   ├── [pi       users   ]  03 - Sade - I Couldn't Love You More.mp3
│   ├── [pi       users   ]  Smolik
│   │   ├── [pi       users   ]  01 - Smolik - SOS Songs feat. Gaba Kulka.mp3
│   │   ├── [pi       users   ]  02 - Smolik - Not Always Happy feat. Joao T. de Sousa.mp3
│   │   ├── [pi       users   ]  03 - Smolik - Memotion feat. Mika Urbaniak.mp3
│   └── [pi       audio   ]  playlists
│       └── [pi       users   ]  myradiostations.m3u
├── [pi       users   ]  tubeNetRadio.py
└── [pi       users   ]  tubeNetRadio.sh

After everything is set up correctly you should be able to launch mpd and manually control it with the frontend called mpc. Try mpc update, mpc ls, mpc add "", mpc play...
For mpd to start always at boot, you have to type the following
systemctl enable mpd
and type
systemctl start mpd
to start it immediately. Some info about starting services on boot in Arch Linux can be found here: https://wiki.archlinux.org/index.php/Systemd#Using_units


GPIO and the button routine


Raspberry Pi GPIO wiring plan for the buttons

We have now mpd running and need some routine on top to poll the buttons and control the music according to the users needs. This is done using a single Python script which uses RPi.GPIO to understand the buttons and mpd-python to play the music. Using these two extensions we have everything on Python level.

Let me explain how the user interface works. There are just two buttons. One skips the radio stations which are stored in the file myradiostations.m3u in the music folder. The other button skips local mp3 music album-wise (not song-by-song) for faster navigation. All the functionality is contained in the following routine.
One issue that stole lots of time was the fact that the connection to the mpd server drops automatically and needs to reestablished or checked each time you want to perform an mpd operation. Skipping whole albums instead of songs adds some complexity to the script. It works basically by looking for the next song with a different album tag than the one currently played. For proper operation your songs have to be tagged.
The buttons have to be connected to GPIO02 and GPIO03 of the GPIO port. Resistors are not necessary since these pins have internal pull-ups.


#!/usr/bin/python2
# pyhton code for the tubeNetRadio project. tubeNetRadio is a Raspberry Pi
# based internet radio / mp3 player with a minimalistic user interface 
# consisting of just two knobs (no display)
#
# Function:
# 
# Button 1: skip to next radio station 
# Button 2: skip to next album of available mp3 archive
#
# www.doc-diy.net
#
#

import mpd
import RPi.GPIO as GPIO
import os
import time

###############################################################################
# constants for readable code
RADIO          = 0
ALBUMS         = 1
PRESSED        = 0

# name of files where the recently played track/radio is stored
lastsongfile   = "/home/pi/lastsongpos"
lastradiofile  = "/home/pi/lastradiopos"
# file with internet radio station playlist
myplaylist     = "myradiostations" # refers to "myradiostations.m3u" in playlist folder

###############################################################################
# setup GPIO
# pinout in chip nomenclature (BCM)

buttonPin0     = 2
buttonPin1     = 3

GPIO.setmode(GPIO.BCM)

GPIO.setup(buttonPin0, GPIO.IN)
GPIO.setup(buttonPin1, GPIO.IN)

##############################################################################
# connect to mpd server

client = mpd.MPDClient() # create client object (this is how mpd works with 
                         # python)

# Reconnect until successful
while 1:
    try:
        status = client.status()
        #print("Initial connect")
        break

    except:
        client.connect("localhost", 6600)
        #print("Initial connect failed ...")
        time.sleep(1)

###############################################################################
# set initial playmode. this setting decides if the player starts as mp3 player 
# or internet radio
playmode = RADIO

# initialize mpd
client.clear()                  # clear playlist
client.update()                 # update library
client.load(myplaylist)         # load playlist with radio stations
client.play()                   # play music
client.repeat(1)                # repeat playlist

###############################################################################
# generate 'recently played' files if missing (at first start for example)
if not os.path.exists(lastsongfile):
    with open(lastsongfile, 'w') as f:
        f.write(str(1))
if not os.path.exists(lastradiofile):
    with open(lastradiofile, 'w') as f:
        f.write(str(1))


###############################################################################
# infinite button polling loop

while True:

    input0 = GPIO.input(buttonPin0)
    input1 = GPIO.input(buttonPin1)

    # because mpd drops the connection automatically it has to be 
    # checked or restablished before any operation. otherwise the 
    # scripts stops
    while 1:
        try:
            status = client.status()
            break
        except:
            client.connect("localhost", 6600)
            print("Reconnect ...")


    ###########################################################################
    if input0 == PRESSED:  # go to album mode or skip album if already in album mode
        if playmode == RADIO:
            playmode = ALBUMS
            client.clear()
            tracks=client.list('file')   # get all files from data base 
                                         # (doesn't load playlists with radio 
                                         # stations)
            for t in tracks:
                client.add(t)

            # play song lastly played
            with open(lastsongfile, 'r') as f:
                songpos = int(f.read())
            client.play(songpos)

        else:

            # get current song id
            songposcur = int(client.currentsong()['pos'])  # get playlist 
                                          # position of current song

            # create list of albums, replace empty entries with dummy
            plsinfo = client.playlistinfo()  # get all track information for 
                                             # playlist
            plsalbums = []
            for alb in plsinfo:
                tmp = alb.get('album','-no-')  # get albums and replace empty 
                                               # entries by -no-
                plsalbums.append(tmp)

            # get album of current song 
            songalbum = plsalbums[songposcur]

            # go through album list and search for the next song with a 
            # differing album name
            for x in range(songposcur, len(plsalbums)):
                songpos = 0 # go to start of playlist, valid only if if 
                            # statement below fails
                if plsalbums[x] != songalbum:
                    songpos = x
                    break

            client.play(songpos)  # play first song of next album

            # save current song id for next restart
            songpos = int(client.currentsong()['pos'])
            print(str(songpos))
            with open(lastradiofile, 'w') as f:
                f.write(str(songpos))
                f.truncate()      # cuts all previous contents like digits


    time.sleep(0.1)   # results in 10 Hz polling of button


Make the button Python script start automatically


We want the python script to start automatically after boot. Similarly to mpd
we need to place the corresponding .service file in /etc/systemd/system. Making this script run properly turned out to be a nightmare, probably due to the trial and error approach I followed. The final outcome that proved to work is here:
[Unit]
Description=autostart tubeNetRadio mpd script
After=default.target

[Service]
Type=oneshot
ExecStart=/home/pi/tubeNetRadio.sh

[Install]
WantedBy=multi-user.target

The first part specifies on what modules this service depends. The middle part says what command should be executed. The last part tells Arch what other modules need our service to start. Using some more elaborated settings smart things can be done. In makes sense to run this service after mpd and wlan started. Any improvements or comments are welcome.
The service has to be launched using
systemctl enable tubeNetRadio
systemctl start tubeNetRadio
Here is a listing of /etc/systemd/system after the launch for reference
[pi@alarmpi ~]$ tree /etc/systemd/system
/etc/systemd/system
├── default.target.wants
│   └── tubeNetRadio.service -> /etc/systemd/system/tubeNetRadio.service
├── getty.target.wants
│   └── getty@tty1.service -> /usr/lib/systemd/system/getty@.service
├── multi-user.target.wants
│   ├── avahi-dnsconfd.service -> /usr/lib/systemd/system/avahi-dnsconfd.service
│   ├── cronie.service -> /usr/lib/systemd/system/cronie.service
│   ├── haveged.service -> /usr/lib/systemd/system/haveged.service
│   ├── mpd.service -> /usr/lib/systemd/system/mpd.service
│   ├── netctl-ifplugd@eth0.service -> /usr/lib/systemd/system/netctl-ifplugd@.service
│   ├── netctl@wlan0\x2dlothar\x2dbucher.service -> /etc/systemd/system/netctl@wlan0\x2dlothar\x2dbucher.service
│   ├── remote-fs.target -> /usr/lib/systemd/system/remote-fs.target
│   ├── rngd.service -> /usr/lib/systemd/system/rngd.service
│   └── sshd.service -> /usr/lib/systemd/system/sshd.service
├── netctl@wlan0\x2dlothar\x2dbucher.service
├── sockets.target.wants
│   └── avahi-daemon.socket -> /usr/lib/systemd/system/avahi-daemon.socket
└── tubeNetRadio.service
You might have noticed, the tubeNetRadio.service launches an intermediate shell script called tubeNetRadio.sh:
#!/bin/bash

sleep 1 && /usr/bin/python2 /home/pi/tubeNetRadio.py
This script just launches the actual tubeNetRadio.py script after the delay of 1 second. The delay has been added because the service didn't start reliably, meaning that after some boots the buttons didn't react and I couldn't switch the radio stations or albums. The delay seems to help, but is a dirty workaround.  I guess setting up the tubeNetRadio.service with some more care will solve the problem and make the intermediate script and the delay unnecessary.


Some facts

  • mpd is very robust and always plays some music, even if the button routine fails.
  • The time from power-on to music is about 30 s for Internet radio
  • Tube heat-up time is about 15 s
  • The "analog" two button interface proved to work much better then any smart phone remote control dropping the connection again and again.
  • Radio can be controlled by non-freaks;)

Download


All source files and some extra info can be downloaded from https://github.com/doc-diy/tubeNetRadio or checked out directly with git:
git clone https://github.com/doc-diy/tubeNetRadio.git
Details of the electrical connections and the way the Raspi is mounted can be found under
www.doc-diy.net/electronics/tubenetradio


Mounting an additional partition


You might have noticed that the Arch image expands to about 2 GB with 1.6 GB already occupied. This leaves just 400 MB for your mp3 collection. To add some volume you can expand the partition to use the whole SD card or create a new partition filling the remaining space. I went for the second option because of a lower risk of breaking the Linux. A second partition can be also easier accessed when the SD card is plugged into a computer, especially when FAT32 has been chosen. I can recommend the programm gparted for all formatting operations if you are under Linux.
Adding a second partition requires the fstab to be modified, see the last line below. The second partition was called /dev/mmcblk0p6 on my Arch Raspberry Pi.
# 
# /etc/fstab: static file system information
#
# <file system> <dir> <type>  <options> <dump>  <pass>
/dev/mmcblk0p1  /boot           vfat    defaults        0       0
/dev/mmcblk0p6 /media/sdcard2gb/ vfat   user,rw,umask=111,dmask=000 0       0

Setting the right options requires some experience. I recommend to have a look at this article: https://wiki.archlinux.org/index.php/fstab

I created the folder /media/sdcard2gb/ as the mount point, but you are free to choose. On the new partition the music resides in the folder music. Finally I deleted the original ~/music folder in home and made a softlink with the same name to the new partition with the music. The link command could be
ln -s /media/sdcard2gb/music ~/music
Remember, mpd was configured to look into the folder called ~/music for playable media.





Feel free to give me any feed back. I would be particularly interested in improving the launching script. Happy implementing!!!

Luk

Sunday 24 November 2013

Seeedstudio - cheap PCBs for the hobbyist



This article describes my experience with a low-budget China based PCB service. 

Although making PCBs with homebrew methods is perfectly feasible, it still remains a painful task nobody likes. For me personally the manual drilling is the last step after which the PCB is ruined. This is why I prefer SMD.
The alternative to stains and stench in your bathroom is to use a professional PCB service. Unfortunately, for a couple of prototype PCBs typically needed the starting price is usually about 40 EUR - too much for hobby projects bringing no financial reward. For a couple of years I've been looking for a cheap PCB service. Many companies were offering good prices, but just in theory. After adding the costs for shipping, money transfer and possible customs the 40 EUR constant remained. Here I exclude all services where you have to contact the people per mail to find out the price.

Recently I came across Seeedstudio (www.seeedstudio.com) from China offering extremely low prices. Having a little project in the queue I immediately decided try them out. I adapted my design slightly to fit into the 50 x 50 mm window. If you stay below that size you get 10 double-sided PCBs for 10 USD. The shipping price was calculated on the website to 8 USD giving 18 USD in total, far below the customs limit of about 30 USD in Germany.
I guess this price comes close to the do-it-yourself price when taking into acount FR4 material, chemistry and all the broken drills. 

Here are the detailed steps of the order:

Adapted my design to 50 x 50 mm for the lowest price. 

Created Gerber files using the Eagle script downloadable from the website. BTW, this was the first time I played with Gerber. It turned out to be very simple. I used the free tool gerbv (http://gerbv.geda-project.org/) to view and check the Gerbers and the Excellon file under Linux. Because I had just a single layer, I omitted the top layer Gerber files in the uploaded zip archive completely. No complains from the service.

2013-10-25 Placed the order uploading the Gerbers. Payment via PayPal, 18 USD.

2013-10-30 Confirmation of shipping

2013-11-23 Received the PCBs! There were even 12 instead 10. The build quality is decent and totally OK for my needs. The drills are centered and the traces look clean. It's of course hard to fail with a design with 24 mil routing. Have a look at the high resolution picture below.




Conclusion

Seeedstudio seems to be a serious business. If you are OK with one month processing time you can enjoy unbeatable prices. The website is user-friendly showing clearly the final price you have to pay. The scripts to generate the Gerbers are provided.
No, I don't have any shares in the company;)

Saturday 20 April 2013

Falling drop simulation with OpenFOAM in 2D



In this post I describe a simple simulation of a falling drop with OpenFOAM. The case data can be downloaded here: drop2d.tgz. All you have to do to run the simulation is to untar it with  

tar xvzf drop2d.tgz

and type

./Allrun 

in the drop2d folder. Your results should look like this:



Please note that the results are not validated in any way and are just of qualitative nature. 2D drops are also not very typical in nature;)


The Setup

Now a few words about the setup. The case is modification of the damBreak tutorial case which uses the solver interFoam. This solver is based on the VOF (volume of fluid) method and is usually used for multiphase problems like the one presented here.
   
The mesh consists of a single block generated with blockMesh. There are separate patches for the top, the sides & bottom and front & back. I observed that the results look realistic or not completely artificial even for very low mesh resolutions. 

The essential setting for a free surface problem like the one described here is the initial condition. In the VOF solver the alpha1 variable describes the local proportion of the fluids in the simulation. In our case 0 stand for pure air and 1 for pure water. Using setFields the scenario shown below can be generated easily.
 
Initial conditions: left: alpha, right: velocity.
The initialisation of alpha consists of just two blocks, the water pool and the drop. Here the corresponding setFieldsDict (it's located in the system folder):

/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

defaultFieldValues
(
    volScalarFieldValue alpha1 0
);

regions
(
    boxToCell // drop
    {
        box (0.046 0.14 -1) (0.054 0.148 1);
        fieldValues
        (
            volScalarFieldValue alpha1 1
            volVectorFieldValue U (0 -1 0)
        );
    }

    boxToCell // water
    {
        box (-1 -1 -1) (1 0.025 1);
        fieldValues
        (
            volScalarFieldValue alpha1 1
        );
    }
);

// ************************************************************************* //

I also prescribed an initial velocity of Uy = -1 to the drop. This simulates a bigger fall height without extending the computational domain. Setting positive values will cause the drop to fly up first and then fall into the water. SetFields allows only boxes for initialisation so the drop looks edged in the beginning. It gets a more physical form during the fall.
One thing that often causes confusion are the .org files in the 0 folder. After running setFields the chosen variable files are extended with volume data for each cell. They might become very large and are only valid for the given mesh. In case you want to change the grid or archive the case, you have to get rid of the volume data. As there is no undo for setFields, it's a good idea to keep the originals (.org) and just make a copy. In the presented case the copying is done by Allrun.

Visualisation  

The case is set up to write out the solution for several time steps. Just type

paraFoam 

in the case folder to view the results. To visulalise only the water and blank out the air the clip filter (everything in paraview is called filter;) is a good choice. It can be found in the menu Filters > Alphabetical > Clip or as a shortcut, see screen shot below. Just select scalar as clipping function, choose alpha1 and set the threshold to 0.5. You should see something like this:

Paraview pipeline for the drop simulation

Clicking on play should start the animation. To make a movie, go to File and choose Save Animation. The time steps will be then saved as single images. Under this link you'll find a quick method to merge the images to a movie:
http://doc-diy.net/photo/image_processing_linux/#makingtimelapse


Happy simulating!


Friday 19 April 2013

Hello world!

Some of you may know my web site www.doc-diy.net related to do-it-yourself projects in electronics, photography and other technical topics. In contrast to the more static site, this blog is going to be the more dynamic counterpart and the place for smaller projects, good and not so good ideas, images, code snippets, etc...
You are welcome to read, comment, criticize, link, follow, add or interact in whatever way this medium allows to.

Stay tuned!

Luk