awacs 发表于 2009-2-13 15:45:09

How to create a new solver?

How to create a new solver based on a standard solver (such as interFoam)?
I want to add temperature and non-newtonian properties to interFoam.
Any suggestions?

Best regards.

OpenFOAM 发表于 2009-2-21 21:16:49

Hi
try to look at the code of interFoam in application/solver/multiphase.and you will find more informations.and the EHDFoam is a solve based on the interFoam with Electrostatic add-on.maybe usefull for you.


Regards

awacs 发表于 2009-2-23 11:28:09

回复 2# OpenFOAM 的帖子

Thanks a lot.
I'm trying to modify the solver--interFoam to overcome the problem.
Firstly,I added the temperature field in createFields.H
Secondly,adding TEqn.H and put it after the PISO loop.
Then, wmake. I got the rhcmFoam solver.

In case design ,I got the following warning:
/*---------------------------------------------------------------------------*\
| =========               |                                                 |
| \\      /F ield         | OpenFOAM: The Open Source CFD Toolbox         |
|\\    /   O peration   | Version:1.5                                 |
|   \\/    A nd         | Web:      http://www.OpenFOAM.org               |
|    \\/   M anipulation|                                                 |
\*---------------------------------------------------------------------------*/
Exec   : rhcmFoam
Date   : Feb 23 2009
Time   : 08:40:49
Host   : linux-3hds
PID    : 5951
Case   : /home/OpenFOAM/OpenFOAM/OpenFOAM-1.5/run/tutorials/rhcmFoam/damBreak
nProcs : 1

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


Reading environmentalProperties
Reading field T

--> FOAM Warning :
    From function Field<Type>::Field(const word& keyword, const dictionary& dict, const label s)
    in file /home/OpenFOAM/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Field.C at line 252
    Reading "/home/OpenFOAM/OpenFOAM/OpenFOAM-1.5/run/tutorials/rhcmFoam/damBreak/0/T::leftWall" from line 25 to line 26
    expected keyword 'uniform' or 'nonuniform', assuming deprecated Field format from Foam version 2.0.
--> FOAM Warning :
    From function Field<Type>::Field(const word& keyword, const dictionary& dict, const label s)
    in file /home/OpenFOAM/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Field.C at line 252
    Reading "/home/OpenFOAM/OpenFOAM/OpenFOAM-1.5/run/tutorials/rhcmFoam/damBreak/0/T::rightWall" from line 31 to line 32
    expected keyword 'uniform' or 'nonuniform', assuming deprecated Field format from Foam version 2.0.
--> FOAM Warning :
    From function Field<Type>::Field(const word& keyword, const dictionary& dict, const label s)
    in file /home/OpenFOAM/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Field.C at line 252
    Reading "/home/OpenFOAM/OpenFOAM/OpenFOAM-1.5/run/tutorials/rhcmFoam/damBreak/0/T::lowerWall" from line 37 to line 38
    expected keyword 'uniform' or 'nonuniform', assuming deprecated Field format from Foam version 2.0.
--> FOAM Warning :
    From function Field<Type>::Field(const word& keyword, const dictionary& dict, const label s)
    in file /home/OpenFOAM/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Field.C at line 252
    Reading "/home/OpenFOAM/OpenFOAM/OpenFOAM-1.5/run/tutorials/rhcmFoam/damBreak/0/T::atmosphere" from line 43 to line 44
    expected keyword 'uniform' or 'nonuniform', assuming deprecated Field format from Foam version 2.0.
Reading field pd

Reading field gamma

Reading field U

Reading/calculating face flux field phi

Reading transportProperties

Selecting incompressible transport model Newtonian
Selecting incompressible transport model Newtonian
Calculating field g.h

time step continuity errors : sum local = 0, global = 0, cumulative = 0
DICPCG:Solving for pcorr, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0, global = 0, cumulative = 0
Courant Number mean: 0 max: 0

Starting time loop

Courant Number mean: 0 max: 0
deltaT = 0.00119048
Time = 0.00119048

MULES: Solving for gamma
Liquid phase volume fraction = 0Min(gamma) = 0Max(gamma) = 0
MULES: Solving for gamma
Liquid phase volume fraction = 0Min(gamma) = 0Max(gamma) = 0
DICPCG:Solving for pd, Initial residual = 0, Final residual = 0, No Iterations 0
DICPCG:Solving for pd, Initial residual = 0, Final residual = 0, No Iterations 0
DICPCG:Solving for pd, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 0, global = 0, cumulative = 0



    gradientInternalCoeffs cannot be called for a genericFvPatchField (actual type uniform)
    on patch leftWall of field T in file "/home/OpenFOAM/OpenFOAM/OpenFOAM-1.5/run/tutorials/rhcmFoam/damBreak/0/T"
    You are probably trying to solve for a field with a generic boundary condition.

    From function genericFvPatchField<Type>::gradientInternalCoeffs() const
    in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 692.

FOAM exiting
***************************************************************************

OpenFOAM 发表于 2009-2-25 01:05:03

It seem that there is something wrong with your boundary definition in T.would you mind post you T file?

bioExplore 发表于 2009-3-10 15:12:25

应该是温度T的边界条件定义问题,肯定是写T文件中边界条件中出错了,expected keyword 'uniform' or 'nonuniform', assuming deprecated Field format from Foam version 2.0.

bioExplore 发表于 2009-3-10 15:15:19

应该是温度T的边界条件定义问题,肯定是写T文件中边界条件中出错了,expected keyword 'uniform' or 'nonuniform', assuming deprecated Field format from Foam version 2.0.
以下是U的边界条件定义
boundaryField
{
    leftWall
    {
      type            fixedValue;
      value         uniform (0 0 0);
    }
    rightWall
    {
      type            fixedValue;
      value         uniform (0 0 0);
    }

awacs 发表于 2009-3-11 17:36:16

多谢二位,温度边界条件定义错了。现在问题解决了:)
页: [1]
查看完整版本: How to create a new solver?