x component of 2nd stokes wave--- C code
* Source code
The following is a C code for x component of 2nd stokes wave
×××××××××××××××××××××
/*second order stokes wave at inlet Boundary, wave velocity components are from equations 3.27 and 3.58, Pengzhi lin. numerical modeling of water waves. CRC press, 2008*/
#include "udf.h"
#define pi 3.14159265359 /*define constants*/
#define U 0.6 /*free stream velocity*/
#define H 0.076 /*wave height*/
#define g 9.81 /*gravity acceleration*/
#define L 4.8 /*wave length*/
#define d 1.6 /*water depth*/
#define T 1.456/*effective wave period (include doppler effect)*/
/*DEFINE_PROFILE: define an inlet velocity profile that varies as a function of z coordinates or t.*/
DEFINE_PROFILE(x_velocity,ft,var) /* DEFINE Macros, ft is a thread; var:index */
{
/*define variables*/
real r[ND_ND]; /*Coordinates, r[0] mean x coordinates, r[1] means y coordinates*/
real k; /*wave number*/
real z; /*z(vertical) axis, gravity direction*/
real omega; /*effective wave angular velocity*/
real t; /*t*/
k = 2.0*pi/L; /*assign values to variables*/
omega=2.0*pi/T;
t = CURRENT_TIME; /* Special Fluent macro, current running t */
face_t f; /* "f" is a face index for each face on the boundary */
begin_f_loop(f,ft)/* face loop macro ,loop over all faces in a given face thread,i.e. "ft" */
{
F_CENTROID(r,f,ft); /*F_CENTROID finds the coordinate position of the centroid of the face "f" and stores the coordinates in the "r" array */
z =r[1]; /* r[1] is y coordinate,r[2] is z coordinate */
F_PROFILE(f,ft,var) = U + H*g*k*cosh(k*(z-0.782+d))*cos(-omega*t)/(2.0*(omega-k*U)*cosh(k*d)) + 3.0*H*H*(omega-k*U)*k*cosh(2.0*k*(z-0.782+d))*cos(-2.0*omega*t)/(16.0*pow(sinh(k*d),4.0));
/*x-velocity component (flow direction): u_r+U= U + H*g*k*cosh(k*(z+d))*cos(-omega*t)/(2.0*(omega-k*U)*cosh(k*d)) + 3.0*H*H*(omega-k*U)*k*cosh(2.0*k*(z+d))*cos(-2.0*omega*t)/(16.0*pow(sinh(k*d),4.0)); z=0 is the mean free surface levelin the theory model, however, free surface level is z=-0.782m in the Fluent geometry model*/
}
end_f_loop(f,ft)
}
vertical component of 2nd stokes wave
/*vertical-velocity component (flow direction) of second order stokes wave at inlet Boundary, wave velocity components are from equations 3.27 and 3.58, Pengzhi lin. numerical modeling of water waves. CRC press, 2008*/
#include "udf.h"
#define pi 3.14159265359 /*define constants*/
#define U 0.6 /*free stream velocity*/
#define H 0.076 /*wave height*/
#define g 9.81 /*gravity acceleration*/
#define L 4.8 /*wave length*/
#define d 1.6 /*water depth*/
#define T 1.456/*effective wave period (include doppler effect)*/
/*DEFINE_PROFILE: define an inlet velocity profile that varies as a function of z coordinates or t.*/
DEFINE_PROFILE(vertical_velocity,ft,var) /* DEFINE Macros, ft is a thread; var:index */
{
/*define variables*/
real r[ND_ND]; /*Coordinates, r[0] mean x coordinates, r[1] means y coordinates; r[2] is z coordinates*/
real k; /*wave number*/
real z; /*z(vertical) axis*/
real omega; /*effective wave angular velocity*/
real t; /*t*/
k = 2.0*pi/L; /*assign values to variables*/
omega=2.0*pi/T;
t = CURRENT_TIME; /* Special Fluent macro, current running t */
face_t f; /* f is a face index for each face on the boundary */
begin_f_loop(f,ft)/* face loop macro ,loop over all faces in a given face thread "ft" */
{
F_CENTROID(r,f,ft); /*F_CENTROID finds the coordinate position of the centroid of the face "f" and stores the coordinates in the "r" array */
z =r[1]; /* r[1] means y coordinates */
F_PROFILE(f,ft,var) = H*g*k*sinh(k*(z-0.782+d))*sin(-omega*t)/(2.0*(omega-k*U)*cosh(k*d)) + 3.0*H*H*(omega-k*U)*k*sinh(2.0*k*(z-0.782+d))*sin(-2.0*omega*t)/(16.0*pow(sinh(k*d),4.0));
/* in the Fluent mode, free surface level is z=0.782m, positive z is in the gravity direction,however, z=0 is the mean free surface level, and z is negative gravity direction in the theory of wave */
/* verticla velocity: w_r= 2.0*a*g*k*sinh(k*(z+d))*sin(-omega*t)/(2.0*(omega-k*U)*cosh(k*d)) + 3.0*2.0*a*2.0*a*(omega-k*U)*k*sinh(2.0*k*(z+d))*sin(-2.0*omega*t)/(16.0*pow(sinh(k*d),4.0)); */
}
end_f_loop(f,ft)
}
×××××××××××××××××××××××××××××××××××××××
x component of 2nd stokes wave--- C code的更多相关文章
- Java Sound : generate play sine wave - source code
转载自:http://ganeshtiwaridotcomdotnp.blogspot.com/2011/12/java-sound-generate-play-sine-wave.html Work ...
- [AS3.0] Error #2044: 未处理的 NetStatusEvent:。 level=error, code=NetStream.Record.NoAcces 解决办法
突然又需要FMS做视频录制,却遇到一些意想不到的问题,我在想当年做的时候怎么没遇到... 报错: Error #2044: 未处理的 NetStatusEvent:. level=error, cod ...
- Peer Code Reviews Made Easy with Eclipse Plug-In
欢迎关注我的社交账号: 博客园地址: http://www.cnblogs.com/jiangxinnju/p/4781259.html GitHub地址: https://github.com/ji ...
- hadoop 2.2.0 编译报错: [ERROR] class file for org.mortbay.component.AbstractLifeCycle not found
[ERROR] class file for org.mortbay.component.AbstractLifeCycle not found 错误堆栈如下: [ERROR] COMPILATIO ...
- [React Intl] Use a react-intl Higher Order Component to format messages
In some cases, you might need to pass a string from your intl messages.js file as a prop to a compon ...
- RFID 读写器 Reader Writer Cloner
RFID读写器的工作原理 RFID的数据采集以读写器为主导,RFID读写器是一种通过无线通信,实现对标签识别和内存数据的读出和写入操作的装置. 读写器又称为阅读器或读头(Reader).查询器(Int ...
- Architecture options to run a workflow engine
This week a customer called and asked (translated into my own words and shortened): “We do composite ...
- Using a USB host controller security extension for controlling changes in and auditing USB topology
Protecting computer systems from attacks that attempt to change USB topology and for ensuring that t ...
- 史上最全的Python电子书教程资源下载(转)
网上搜集的,点击即可下载,希望提供给有需要的人^_^ O'Reilly.Python.And.XML.pdf 2.02 MB OReilly - Programming Python 2nd. ...
随机推荐
- bzoj 1783: [Usaco2010 Jan]Taking Turns【贪心+dp】
不知道该叫贪心还是dp 倒着来,记f[0][i],f[1][i]分别为先手和后手从n走到i的最大值.先手显然是取最大的,当后手取到比先手大的时候就交换 #include<iostream> ...
- bzoj 4756: [Usaco2017 Jan]Promotion Counting【dfs+树状数组】
思路还是挺好玩的 首先简单粗暴的想法是dfs然后用离散化权值树状数组维护,但是这样有个问题就是这个全局的权值树状数组里并不一定都是当前点子树里的 第一反应是改树状数组,但是显然不太现实,但是可以这样想 ...
- 10.16NOIP模拟赛
/* 我是一个大sb */ #include<iostream> #include<cstdio> #include<cstring> #include<qu ...
- 学习http协议的三次握手和四次挥手 ~~笔记
http协议是基于tcp协议的 所以应该说是tcp协议的三次握手和四次挥手 SYN:请求建立连接,并在其序列号的字段进行序列号的初始值设定.建立连接,设置为1 FIN:用来释放一个连接.FIN=1表 ...
- 【计蒜客习题】两仪剑法(gcd)
两仪剑法是武当派武功的高级功夫,且必须 2 个人配合使用威力才大.同时该剑法招数变化太快.太多.设武当弟子甲招数变化周期为 n,武当弟子乙招数变化周期为 m,两弟子同时使用该剑法,当 2 人恰好同时达 ...
- 仓鼠找sugar II
题目描述 小仓鼠的和他的基(mei)友(zi)sugar住在地下洞穴中,每个节点的编号为1~n.地下洞穴是一个树形结构.这一天小仓鼠打算从从他的卧室(a,是任意的)他的基友卧室(b,还是任意的).(注 ...
- Too many open files故障解决一例
Linux环境WebSphere输出日志: [// ::: EDT] 000090b7 SystemErr R Caused by: java.io.FileNotFoundException: /o ...
- 数据传递-------ajaxJson------spring3mvc中使用ajax传json中文乱码解决
参考来源:http://blog.csdn.net/dangerous_fire/article/details/25904225 第一种解决方法,适用所有情况 因为在controller中返回jso ...
- 纵横填字js
新数据结构设计: 定义一个map: key是横纵坐标字符串,比如“0,4” value是一个json,包含以下属性:字,横向的词(若 有的话,无的话,空串),纵向的词(若有的话,无的话,空串). 另有 ...
- ES6十大常用特性
. Default Parameters(默认参数) in ES6 2. Arrow Functions (箭头函数)in ES6 3. Block-Scoped Constructs ...