Skip to content
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
CFD中文网

CFD中文网

  1. CFD中文网
  2. OpenFOAM
  3. 如何在of里得到current time

如何在of里得到current time

已定时 已固定 已锁定 已移动 OpenFOAM
1 帖子 1 发布者 1.3k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • W 离线
    W 离线
    WYing
    写于 最后由 编辑
    #1

    问题背景:将sixDoFRigidBodyMotion中linearSpring的参数stiffness从常数改成随时间变化的函数 stiffness = f(t)
    f(t) 可以是分段函数也可以是任意函数,t为目前的计算时间。

    因此我对$FOAM_SRC/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion/restraints/linearSpring目录中的.C和.H文件进行改动。但是在获得当前计算时间这一步遇到了问题。。尝试了多种方法都无法编译,以下是我尝试的一些语句和报错:

    (1) scalar current_time = db().time().value()
    Error: ‘db’ was not declared in this scope
    (2) scalar current_time = runTime().value()
    scalar current_time = runTime_.time().timeOutputValue();
    Error: ‘runTime’ was not declared in this scope
    (3) scalar current_time = timeDirs.last().value()
    Error: ‘timeDirs’ was not declared in this scope
    (4) scalar current_time = U.runTime().value();
    scalar current_time = U_.thisDb().time().value();
    Error: ‘U’ was not declared in this scope
    (5) scalar current_time = mesh_.time().value();
    Error: ‘mesh_’ was not declared in this scope
    (6) scalar current_time = this->db().time().timeOutputValue();
    Error: ‘const class Foam::sixDoFRigidBodyMotionRestraints::linearSpring’ has no member named ‘db’

    挺简单一个问题,在网上找了很多方法,都失败了。。。不知道是不是因为没有包含需要的头文件?或者除了修改库文件,是否还有其他方法修改常数参数为time-dependent参数?请大神指教!!

    1 条回复 最后回复

  • 登录

  • 登录或注册以进行搜索。
  • 第一个帖子
    最后一个帖子
0
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]