CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Apparent wind Speed (moving object) (

Solo Sails December 5, 2011 06:10

Apparent wind Speed (moving object)

Is there a way to assign a velocity to an object within a domain without actually making it move?

I am trying to recreate the twisted apparent wind angle experienced by a yacht moving through the the wind. Due to the gradient atmospheric boundary layer, the boat experiences a more acute angle of attack lower down the rig due to an increased vector of the boat speed to wind speed.

I have come to the conclusion that even if it is possible to recreate the correct vertical 'twist' which I have done, it is still impossible to create the increased apparent wind speed by using a static object (boat). It seems the only way to do this correctly is to actually move the boat itself.

However, although I know there is a way of doing this within OpenFoam, it looks daunting and beyond my capability at the moment.

So my question is, is there a way to assign a 'speed' or velocity to an object even if it is static within the case domain?

(If that makes any sense at all!)



Hannes_Kiel December 5, 2011 09:12


basically it's a vector addition of true wind and boat velocity. First you've got to define a profile of true wind speed over height, e.g. by TWS(z)=TWS_10m*(z/10m)^e, with e = 0.1 for offshore or e = 0.17 for inshore.
Disregarding heel, the apparent wind speed and angle over height are calculated by
AWS(z) = ((TWS(z)*cos(TWA)+u)^2+(TWS(z)*sin(TWA))^2)^0.5
AWA(z) = arctan((TWS(z)*sin(TWA))/((TWS(z)*cos(TWA)+u))


Solo Sails December 5, 2011 09:18

Hi Hannse,

Thanks for your reply, I have the details for working out the figures, but...

How do you go about defining the inlet velocity at certain heights?

Thanks, Andrew

Hannes_Kiel December 5, 2011 09:48

When simulating sails (until now with other codes but working on getting it done in OF), I define the Apparent wind as function of height on the inlets and as initial values, by the formulae I posted (decomposed to vector components). the floor is assigned the boats velocity. This way you get a situation you'd see standing on the boat with the environment moving around you.

Solo Sails December 5, 2011 09:53

Hi again,

OK, I think I understand what you mean, but I am not sure how to assign the inlet values (sorry I am very new to OpenFoam).

I am currently using the Atmospheric Boundary Layer setting for the inlet valve which as far as I can see calculates the boundary layer and gradient for standard atmospheric conditions, but I'm not sure how to modify this. Do you know how this is done?

Also, re the floor velocity, does this effect anything within the domain?

Hannes_Kiel December 5, 2011 09:58

Actually, I've never used the Atmospheric Boundary Layer setting, but I suppose it is intended for stationary object like wind turbines. Further, I suppose it generates a vector field depending on height, to this it might be possible to add a global motion vector (boat speed) somewhere in the code.
The motion of the floor affects the boundary layer next to the water surface. If it is moving, you get a nature-like setup, if it is stationary, you have a wind-tunnel like setup.

Solo Sails December 5, 2011 10:02

Hmm, interesting, I will try adding a floor velocity.

So are you able to modify a standard fixed velocity inlet to make it a gradient ?

If so, how is this done?


Hannes_Kiel December 5, 2011 10:27

Actually, in OF I haven't tried yet (only CFX and Star-CCM). GroovyBC resp. SWAK sounds quite good for it. Perhaps I'll manage to look into it within the next few days.

Solo Sails December 5, 2011 10:28

OK, let me know how you go!

Thanks for your input


Solo Sails December 7, 2011 11:38

Anybody else know if it's ...

a) possible to assign a velocity to an object so that it moves relative to the set flow velocity (but not in the domain)?

b) Possible to modify the the vertical velocity for an inlet?



jcriner December 8, 2011 17:59

1 Attachment(s)
Once you figure out what type of initial and boundary conditions best suit your problem, the attached files may help you with the mechanics of how to achieve your goals.

I highly recommend Bernhard Gschaider's swak4Foam for groovyBC, funkySetFields, and funkySetBoundaryField to start. If you have more specific needs and are experienced in OpenFOAM++, then write your custom own code to initialize fields a la appWindInit.

The package contains some examples of various approaches. Download and untar the file, then:

Compile and install swak4Foam
Compile and install appWindInit (provided in package)
cd appWindTest
./Allclean (read what's going on inside)
./Allrun (read what's going on inside)
Then compare:
0/U = the original state (groovyBC Dict in U on xMin)
1/U = funkySetFields only (system/funkySetFieldDict)
2/U = funkySetFields + funkySetBoundaryField (system/funkySetBoundaryDict)
3/U = appWindInit (system/appWindDict)

It's up to the you to determine what method suits your needs best and why.

The appWindInit code is known to compile on OpenFOAM-1.6-ext and OpenFOAM-2.0.x. The appWindTest runs on OpenFOAM-1.6-ext, and should run on 2.0.x with no or minor modifications.

Good Luck.


Solo Sails December 13, 2011 09:34

Hi James,

Thanks for your reply,

That seems a bit beyond my skills for the moment, but will take the time to have a closer look.

Thanks very much for your help,


All times are GMT -4. The time now is 08:54.