|
| 1 | +#include "createRDeltaT.H" |
| 2 | + |
| 3 | +word continuousPhaseName |
| 4 | +( |
| 5 | + IOdictionary |
| 6 | + ( |
| 7 | + IOobject |
| 8 | + ( |
| 9 | + "continousPhase", |
| 10 | + runTime.constant(), |
| 11 | + mesh, |
| 12 | + IOobject::MUST_READ |
| 13 | + ) |
| 14 | + ).lookup("continuousPhaseName") |
| 15 | +); |
| 16 | +// 在constant文件夹中添加一个continousPhase文件,其中信息就是continuousPhaseName的值,也就是流体名称 |
| 17 | +// 注意:还是只有一个thermophysicalProperties文件,只是给他加了个名字 |
| 18 | +Info<< "Reading thermophysical properties\n" << endl; |
| 19 | + |
| 20 | +autoPtr<fluidThermo> pThermo |
| 21 | +( |
| 22 | + fluidThermo::New(mesh) |
| 23 | +); |
| 24 | +fluidThermo& thermo = pThermo(); |
| 25 | +thermo.validate(args.executable(), "h", "e"); |
| 26 | + |
| 27 | +volScalarField& p = thermo.p(); |
| 28 | + |
| 29 | +volScalarField rho |
| 30 | +( |
| 31 | + IOobject |
| 32 | + ( |
| 33 | + "rho", |
| 34 | + runTime.timeName(), |
| 35 | + mesh, |
| 36 | + IOobject::NO_READ, |
| 37 | + IOobject::NO_WRITE |
| 38 | + ), |
| 39 | + thermo.rho() |
| 40 | +); |
| 41 | + |
| 42 | +Info << "Creating field alphac\n" << endl; |
| 43 | +// 在time文件夹中存在alphac文件,不需要特意创建 |
| 44 | +volScalarField alphac |
| 45 | +( |
| 46 | + IOobject |
| 47 | + ( |
| 48 | + IOobject::groupName("alpha", continuousPhaseName), |
| 49 | + runTime.timeName(), |
| 50 | + mesh, |
| 51 | + IOobject::READ_IF_PRESENT, |
| 52 | + IOobject::AUTO_WRITE |
| 53 | + ), |
| 54 | + mesh, |
| 55 | + dimensionedScalar(dimless, 1) |
| 56 | +); |
| 57 | + |
| 58 | +Info<< alphac << endl; |
| 59 | + |
| 60 | +Info<< "Reading field U\n" << endl; |
| 61 | +// U文件改名叫做 U.water(或者其他流体名称) 记得修改 |
| 62 | +volVectorField U |
| 63 | +( |
| 64 | + IOobject |
| 65 | + ( |
| 66 | + IOobject::groupName("U", continuousPhaseName), |
| 67 | + runTime.timeName(), |
| 68 | + mesh, |
| 69 | + IOobject::MUST_READ, |
| 70 | + IOobject::AUTO_WRITE |
| 71 | + ), |
| 72 | + mesh |
| 73 | +); |
| 74 | + |
| 75 | +#include "compressibleCreatePhi.H" |
| 76 | +// 没办法还是使用了可压缩的Phi 只是同时定义了一个不可压缩的phi_u配合别的使用 |
| 77 | +Info<< "Reading/calculating face flux field phi(U only)\n" << endl; |
| 78 | +// surfaceScalarField phi_u |
| 79 | +// ( |
| 80 | +// IOobject |
| 81 | +// ( |
| 82 | +// "phi_u", |
| 83 | +// runTime.timeName(), |
| 84 | +// mesh, |
| 85 | +// IOobject::READ_IF_PRESENT, |
| 86 | +// IOobject::AUTO_WRITE |
| 87 | +// ), |
| 88 | +// fvc::flux(U) |
| 89 | +// ); |
| 90 | +// 这里的phi是基于U,直接显示标出来了方便后面的直接使用 |
| 91 | +Info<< "Creating field alphaRhoPhi\n" << endl; |
| 92 | +surfaceScalarField alphaRhoPhi |
| 93 | +( |
| 94 | + IOobject |
| 95 | + ( |
| 96 | + "alphaRhoPhi", |
| 97 | + runTime.timeName(), |
| 98 | + mesh, |
| 99 | + IOobject::NO_READ, |
| 100 | + IOobject::NO_WRITE |
| 101 | + ), |
| 102 | + linearInterpolate(alphac*rho*U) & mesh.Sf() |
| 103 | +); |
| 104 | +// 这里是基于alphac,rho和U 模仿compressible phi的创建方式 |
| 105 | + |
| 106 | +Info<< "Creating Multiphase turbulence model\n" << endl; |
| 107 | +autoPtr<PhaseCompressibleMomentumTransportModel<fluidThermo>> turbulence |
| 108 | +( |
| 109 | + PhaseCompressibleMomentumTransportModel<fluidThermo>::New |
| 110 | + ( |
| 111 | + alphac, |
| 112 | + rho, |
| 113 | + U, |
| 114 | + alphaRhoPhi, |
| 115 | + phi, |
| 116 | + thermo |
| 117 | + ) |
| 118 | +); |
| 119 | +// Info<< "Creating turbulence model\n" << endl; 这部分代码是原始的 单相流体的模型 |
| 120 | +// autoPtr<compressible::momentumTransportModel> turbulence 经过测试发现,并不是因为这个原因导致的结果发散 |
| 121 | +// ( |
| 122 | +// compressible::momentumTransportModel::New |
| 123 | +// ( |
| 124 | +// rho, |
| 125 | +// U, |
| 126 | +// phi, |
| 127 | +// thermo |
| 128 | +// ) |
| 129 | +// ); |
| 130 | + |
| 131 | +typedef PhaseThermophysicalTransportModel |
| 132 | + < |
| 133 | + PhaseCompressibleMomentumTransportModel<fluidThermo>, |
| 134 | + fluidThermo |
| 135 | + > multiphaseThermophysicalTransportModel; |
| 136 | +// 重名一个类,用于创造热扩散模型 |
| 137 | + |
| 138 | +Info<< "Creating Multiphase Thermophysical TransportModel Model with VOF\n" << endl; |
| 139 | + |
| 140 | +autoPtr<multiphaseThermophysicalTransportModel> thermophysicalTransport |
| 141 | +( |
| 142 | + multiphaseThermophysicalTransportModel::New(turbulence(), thermo) |
| 143 | +); |
| 144 | + |
| 145 | +// Info<< "Creating thermophysical transport model\n" << endl; 问题同上 |
| 146 | +// autoPtr<fluidThermophysicalTransportModel> thermophysicalTransport 经过测试其实不是模型的问题 |
| 147 | +// ( |
| 148 | +// fluidThermophysicalTransportModel::New(turbulence().transportModel, thermo) |
| 149 | +// ); |
| 150 | + |
| 151 | +Info<< "nu for thermophysicalTransport\n" << thermophysicalTransport->thermo() << endl; |
| 152 | + |
| 153 | + |
| 154 | +#include "readGravitationalAcceleration.H" |
| 155 | +#include "readhRef.H" |
| 156 | +#include "gh.H" |
| 157 | +#include "readpRef.H" |
| 158 | + |
| 159 | + |
| 160 | +Info<< "Reading field p_rgh\n" << endl; |
| 161 | +volScalarField p_rgh |
| 162 | +( |
| 163 | + IOobject |
| 164 | + ( |
| 165 | + "p_rgh", |
| 166 | + runTime.timeName(), |
| 167 | + mesh, |
| 168 | + IOobject::MUST_READ, |
| 169 | + IOobject::AUTO_WRITE |
| 170 | + ), |
| 171 | + mesh |
| 172 | +); |
| 173 | + |
| 174 | +// Force p_rgh to be consistent with p |
| 175 | +p_rgh = p - rho*gh - pRef; |
| 176 | + |
| 177 | +pressureControl pressureControl |
| 178 | +( |
| 179 | + p, |
| 180 | + p_rgh, |
| 181 | + rho, |
| 182 | + pimple.dict(), |
| 183 | + thermo.incompressible() |
| 184 | +); |
| 185 | + |
| 186 | +mesh.setFluxRequired(p_rgh.name()); |
| 187 | + |
| 188 | +Info<< "Creating field dpdt\n" << endl; |
| 189 | +volScalarField dpdt |
| 190 | +( |
| 191 | + IOobject |
| 192 | + ( |
| 193 | + "dpdt", |
| 194 | + runTime.timeName(), |
| 195 | + mesh |
| 196 | + ), |
| 197 | + mesh, |
| 198 | + dimensionedScalar(p.dimensions()/dimTime, 0) |
| 199 | +); |
| 200 | + |
| 201 | +Info<< "Creating field kinetic energy K\n" << endl; |
| 202 | +volScalarField K("K", 0.5*magSqr(U)); |
| 203 | + |
| 204 | +dimensionedScalar initialMass = fvc::domainIntegrate(rho); |
| 205 | + |
| 206 | +#include "createMRF.H" |
| 207 | +#include "createRadiationModel.H" |
| 208 | +#include "createFvOptions.H" |
0 commit comments