|
[Sponsors] |
decomposePar for custom solvers and boundary conditions |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 31, 2015, 01:56 |
decomposePar for custom solvers and boundary conditions
|
#1 |
Member
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11 |
dear foamers,
I am grateful that you are interested in parallel computing and the decomposePar utility. I now encounter 2 problems when parallelizing mySlover: (1) the custom boundary conditions. In the 0 or latestTime directory, one of the patch is as follows (before decomposePar): Code:
myPatchName { type myBC; // does decomposePar know myBC after its compilation? phi phi; rho rho; volumeFlux 100; value nonuniform List<vector> 2((0.6 -0.7 0) (0.1 -0.2 0)); } Code:
myPatchName { type myBC; phi phi; rho rho; volumeFlux 0; // myPatch is indeed in the computational domain of processor0. why becomes 0??? value nonuniform List<vector> 2((0.6 -0.7 0) (0.1 -0.2 0)); } Code:
{ type myBC; phi phi; rho rho; volumeFlux 0; // myPatch is not in this computational domain value nonuniform 0(); // myPatch is not in this computational domain } Code:
myPatchName { type myBC; phi phi; rho rho; volumeFlux 99.5; // this is normal value nonuniform List<vector> 2((0.4 -0.5 0) (0.4 -0.5 0)); } Code:
myPatchName { type myBC; phi phi; rho rho; volumeFlux 0; // why 0??? shouldn't it be 99.5??? value nonuniform List<vector> 2((0.4 -0.5 0) (0.4 -0.5 0)); // this is normal } (2) as you may have known, the above is for the 2D case. while mySolver is the one that coupling 1D and 2D computation. So should I only make the 2D computing parallelizable or both the 1D and 2D? and if possible, how could i make the implementation? I am very appreciated if someone understands my problem and kindly gives some hints. and also, feel free to remedy my mistakes. thanks a lot! /karelke |
|
October 31, 2015, 07:49 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Quick answers:
For the first issue, without seeing the source code, the best I can do is suggest that you take a better look at OpenFOAM's own boundary conditions for ideas on how these variables are handled in the constructors and in the "write" method. In addition, see this post for more ideas: http://www.cfd-online.com/Forums/ope...tml#post567594 - post #8 For the second issue, I can't figure out what you're asking from your description Please provide more details.
__________________
|
|
October 31, 2015, 08:21 |
|
#3 | |
Member
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11 |
Quote:
for the first issue, myBC is attached. for the second one, i mean that the 1D solver is totally user-developed. its framework is not exactly confirm to the OF convention, especially for the 1D mesh and solution schemes. so I feel quit difficult to make my coupled solver parallelizable. besides, I think that the 1D calculation is not very time-consuming. so is it possible to only parallel computing the 2D problem? and how this will effect the 1D solution? hope i've made that clear. thanks for your attention. |
||
October 31, 2015, 09:05 |
|
#4 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Quick answers:
You have this constructor that is incorrect: Code:
timeVaryingVolumeFluxInletDPUWFvPatchVectorField:: timeVaryingVolumeFluxInletDPUWFvPatchVectorField ( const fvPatch& p, const DimensionedField<vector, volMesh>& iF, const dictionary& dict ) : fixedValueFvPatchField<vector>(p, iF, dict), timeDataFileName_(fileName(dict.lookup("timeDataFileName")).expand()), timeDataPtr_(NULL), volumeFlux_(0), phiName_("phi"), rhoName_("rho") { if (dict.found("phi")) { dict.lookup("phi") >> phiName_; } if (dict.found("rho")) { dict.lookup("rho") >> rhoName_; } } Code:
timeVaryingVolumeFluxInletDPUWFvPatchVectorField:: timeVaryingVolumeFluxInletDPUWFvPatchVectorField ( const fvPatch& p, const DimensionedField<vector, volMesh>& iF, const dictionary& dict ) : fixedValueFvPatchField<vector>(p, iF, dict), timeDataFileName_(fileName(dict.lookup("timeDataFileName")).expand()), timeDataPtr_(NULL), volumeFlux_(readScalar(dict.lookup("volumeFlux"))), phiName_("phi"), rhoName_("rho") { if (dict.found("phi")) { dict.lookup("phi") >> phiName_; } if (dict.found("rho")) { dict.lookup("rho") >> rhoName_; } } Quote:
OpenFOAM relies in using the boundary condition "empty" for neutralizing a direction. Therefore, if you have a 1D problem, then your mesh should only be 1 cell of width over 2 directions and on those directions you should use the "empty" boundary condition. As for the equations, you should define them the same way as OpenFOAM does for other solvers. As for coupling... it depends on the type of coupling you're trying to do. For example, "chtMultiRegionFoam" is a complex solver that serves as an example on how OpenFOAM and handle coupling between semi-independent mesh regions. But there is also the coupling that can be done at the matrix solver level: http://www.openfoam.org/version2.2.0/matrix-solvers.php Last edited by wyldckat; October 31, 2015 at 09:06. Reason: corrected the constructor |
||
October 31, 2015, 10:05 |
|
#5 |
Member
Karelke Yu
Join Date: Dec 2014
Posts: 96
Rep Power: 11 |
thanks very much! your directions exactly fix the problem. but i wrote as:
Code:
timeVaryingVolumeFluxInletDPUWFvPatchVectorField:: timeVaryingVolumeFluxInletDPUWFvPatchVectorField ( const fvPatch& p, const DimensionedField<vector, volMesh>& iF, const dictionary& dict ) : fixedValueFvPatchField<vector>(p, iF, dict), timeDataFileName_(fileName(dict.lookup("timeDataFileName")).expand()), timeDataPtr_(NULL), volumeFlux_(0), phiName_("phi"), rhoName_("rho") { if (dict.found("volumeFlux")) { dict.lookup("volumeFlux") >> volumeFlux_; // these fix the problem } if (dict.found("phi")) { dict.lookup("phi") >> phiName_; } if (dict.found("rho")) { dict.lookup("rho") >> rhoName_; } } it seems that the setFields utility could make it. but is there more tips about this tool or other ways to do that? there is only one region in the tutorial interFoam. thanks for your help and i hope i do not make personal foul. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Issues on the simulation of high-speed compressible flow within turbomachinery | dowlee | OpenFOAM Running, Solving & CFD | 11 | August 6, 2021 07:40 |
How the boundary conditions are called in the OpenFOAM solvers? | openfoammaofnepo | OpenFOAM Programming & Development | 15 | February 11, 2020 05:28 |
Tutorial on compiling new solvers, utilities, boundary conditions, etc. | lordvon | OpenFOAM Programming & Development | 2 | May 13, 2015 10:06 |
several fields modified by single boundary condition | schröder | OpenFOAM Programming & Development | 3 | April 21, 2015 06:09 |
Need help with boundary conditions: open to atmosphere | Wolle | OpenFOAM | 2 | April 11, 2011 08:32 |