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中文网

水

水润晨阳

@水润晨阳
关于
帖子
3
主题
1
群组
0
粉丝
0
关注
1

帖子

最新

  • OpenFOAM libtorch tutorial step by step
    水 水润晨阳

    @李东岳 在 OpenFOAM libtorch tutorial step by step 中说:

    net.H

    #include <torch/torch.h>
    
    class NN
    :
        public torch::nn::Module 
    {
        torch::nn::Sequential net_;
    
    public:
    
        NN();
    
        torch::Tensor forward(torch::Tensor x);
    };
    
    
    
    

    net.C

    /*---------------------------------------------------------------------------*\
      =========                 |
      \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
       \\    /   O peration     | Website:  https://openfoam.org
        \\  /    A nd           | Copyright (C) 2022-2023 OpenFOAM Foundation
         \\/     M anipulation  |
    -------------------------------------------------------------------------------
    License
        This file is part of OpenFOAM.
    
        OpenFOAM is free software: you can redistribute it and/or modify it
        under the terms of the GNU General Public License as published by
        the Free Software Foundation, either version 3 of the License, or
        (at your option) any later version.
    
        OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
        ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        for more details.
    
        You should have received a copy of the GNU General Public License
        along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
    
    Class
    
    See also
    
    SourceFiles
    
    \*---------------------------------------------------------------------------*/
    #include "net.H"
    
    NN::NN()
    {
        net_ = register_module
        (
            "net", 
            torch::nn::Sequential
            (
                torch::nn::Linear(2,20),
                torch::nn::ReLU(),
                torch::nn::Linear(20,30),
                torch::nn::ReLU(),
                torch::nn::Linear(30,30),
                torch::nn::ReLU(),
                torch::nn::Linear(30,20),
                torch::nn::ReLU(),
                torch::nn::Linear(20,20),
                torch::nn::ReLU(),
                torch::nn::Linear(20,1)
            )
        );
    };
    
    torch::Tensor NN::forward(torch::Tensor x) 
    {
        return net_->forward(x);
    }
    
    

    这个要编译成库,挂到PINNFoam上面

    李老师 请问这个如何编译并挂载呢 可以详细的指导一下吗


  • 第一次在中文网发问题,还请大神能够帮助我
    水 水润晨阳

    想模拟一个二维数值波浪水池里规则波与液箱的相互作用问题。
    求解器用的是waveDyMFoam ,属于interFoam里的二相流求解器。
    不知道如何设置边界条件。
    刚开始把水箱的外表面设为wall1,内表面为wall2,两者的边界条件如下:
    P:fixedFluxPressure;
    V:movingWallVelocity;
    alpahwater:zeroGradient
    pointdDisplacement: calculated;
    Dynamicdic设置没有问题。
    结果跑不起来。
    我又把内边界wall2的边界条件改为:
    V:
    PointDisplacement:fixedValue

    V:fixedValue
    其余不变,结果还是跑不起来。
    请问有大神知道哪里出了问题吗?感激不尽:xinxin:
    !cfd2.png cfd.png

  • 登录

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