|
[Sponsors] | |||||
Adding dimensioned scalar/scalar field to chtMultiRegionSimpleFoam/chtMultiRegionFoam |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|
|
#1 |
|
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 8 ![]() |
Hi Foamers,
I am currently trying to add electrical potential transport equations to chtMultiRegionSimpleFoam/chtMultiRegionFoam. However, I failed to add dimensioned scalars and scalar fields to createFields.H (createSolidFields.H) in chtMultiRegionFoam. The way I did is the same as what I did for icoFoam (https://openfoamwiki.net/index.php/H...ure_to_icoFoam) But it does not work here. In chtMultiRegionFoam, the createFields.H (createSolidFields.H) file is more complex and it seems that the way of defining scalars is also different, which I don't understand by scanning the code lines. Does anyone have any idea/experience on this? Btw I installed Openfoam 5x because it's the latest version that still has chtMultiRegionSimpleFoam, while the later versions combine chtMultiRegionSimpleFoam and chtMultiRegionFoam. Thanks in advance, Lan |
|
|
|
|
|
|
|
|
#2 |
|
Member
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 11 ![]() |
Would you share what you are trying to do exactly, your modifications and the error that you get? This way is it not possible to guess where you are having a problem.
For v6, v7, you can use chtMultiRegionFoam as well, you just define it as steady problem and it works like old chtMultiRegionSimpleFoam I guess. |
|
|
|
|
|
|
|
|
#3 | |
|
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 8 ![]() |
Quote:
Simply speaking, I'm trying to add a transport equation into chtMultiRegionFoam like fvm::laplacian(a, X) == b My current problem is to implement the parameters / dimensioned scalars (a and b) and the scalar field (X). In the tutorial that I listed above, it can be done by simply add the lines below into createFields.H: HTML Code:
Info<< "Reading diffusivity a" << endl;
dimensionedScalar a
(
transportProperties.lookup("a")
);
Info<< "Reading field fe and fH\n" << endl;
volScalarField X
(
IOobject
(
"X",
runTime.timeName(),
solidRegions[i],
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
solidRegions[i]
);
HTML Code:
// Initialise solid field pointer lists
PtrList<coordinateSystem> coordinates(solidRegions.size());
PtrList<solidThermo> thermos(solidRegions.size());
PtrList<radiation::radiationModel> radiations(solidRegions.size());
PtrList<fv::options> solidHeatSources(solidRegions.size());
PtrList<volScalarField> betavSolid(solidRegions.size());
PtrList<volSymmTensorField> aniAlphas(solidRegions.size());
List<bool> residualReachedSolid(solidRegions.size(), true);
List<bool> residualControlUsedSolid(solidRegions.size(), false);
Thanks again, Lan Last edited by Lann; March 10, 2020 at 06:38. |
||
|
|
|
||
|
|
|
#4 |
|
Senior Member
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 131
Rep Power: 12 ![]() |
I've been recently trying to adapt chMultiRegionFoam as well. Using OF6 in this my case.
As far as I can understand the code, in this solver the parameters (T, p, rho, ...) are not contained in a single field but each region has its own parameters. In the fluid/createFluidFields.H file a series of PtrList are defined for the magnitudes of interes. Bellow, inside the forAll loop, these properties are read and stored in the list. Code:
// Initialise fluid field pointer lists
PtrList<rhoReactionThermo> thermoFluid(fluidRegions.size());
PtrList<volScalarField> rhoFluid(fluidRegions.size());
PtrList<volVectorField> UFluid(fluidRegions.size());
PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
PtrList<uniformDimensionedScalarField> hRefFluid(fluidRegions.size());
PtrList<volScalarField> ghFluid(fluidRegions.size());
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
PtrList<compressible::turbulenceModel> turbulenceFluid(fluidRegions.size());
PtrList<CombustionModel<rhoReactionThermo>> reactionFluid(fluidRegions.size());
PtrList<volScalarField> p_rghFluid(fluidRegions.size());
PtrList<radiation::radiationModel> radiation(fluidRegions.size());
PtrList<volScalarField> KFluid(fluidRegions.size());
PtrList<volScalarField> dpdtFluid(fluidRegions.size());
PtrList<multivariateSurfaceInterpolationScheme<scalar>::fieldTable>
fieldsFluid(fluidRegions.size());
PtrList<volScalarField> QdotFluid(fluidRegions.size());
List<scalar> initialMassFluid(fluidRegions.size());
PtrList<IOMRFZoneList> MRFfluid(fluidRegions.size());
PtrList<fv::options> fluidFvOptions(fluidRegions.size());
// Populate fluid field pointer lists
forAll(fluidRegions, i)
{
Info<< "*** Reading fluid mesh thermophysical properties for region "
<< fluidRegions[i].name() << nl << endl;
Info<< " Adding to thermoFluid\n" << endl;
thermoFluid.set(i, rhoReactionThermo::New(fluidRegions[i]).ptr());
...
}
The same things apply to the solid fields, in case you need to modify them. Hope it helps! |
|
|
|
|
|
|
|
|
#5 |
|
Member
Hasan Celik
Join Date: Sep 2016
Posts: 64
Rep Power: 11 ![]() |
You need to define it in a such way:
Code:
betavSolid.set
(
i,
new volScalarField
(
IOobject
(
"betavSolid",
runTime.timeName(),
solidRegions[i],
IOobject::NO_READ,
IOobject::NO_WRITE
),
solidRegions[i],
dimensionedScalar(dimless, scalar(1))
)
);
|
|
|
|
|
|
|
|
|
#6 |
|
New Member
Xun Lan
Join Date: Oct 2019
Posts: 21
Rep Power: 8 ![]() |
Thanks Carlos! I'll look into setRegionFluid/SolidField.H
|
|
|
|
|
|
![]() |
| Tags |
| adding term, chtmulitregionfoam, chtmultiregionsimplefoam, solver development |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| multiRegionHeater error | ordinary | OpenFOAM Running, Solving & CFD | 2 | June 9, 2020 18:43 |
| Adding magnetic field to rhoCentralFoam | pumpkinITER | OpenFOAM Programming & Development | 5 | April 7, 2016 13:33 |
| chtMultiRegionSimpleFoam: strange error | samiam1000 | OpenFOAM Running, Solving & CFD | 26 | December 29, 2015 23:14 |
| Adding Temperature field to IcoFoam | yapalparvi | OpenFOAM Programming & Development | 14 | November 19, 2015 05:57 |
| Adding temperature field to InterFoam | yapalparvi | OpenFOAM Running, Solving & CFD | 8 | October 14, 2009 21:18 |