set directory for subMesh
I am stucked and need help.
I create my subMesh as fvMeshSubset sm(mesh); sm.setCellSubset(sub); with the submesh I create volScalarField k_e and h_e What I actually need is the laplacian matrix fvMatrix<scalar> m = fvm::laplacian(k_e, h_2) But sm.subMesh().schemesDict() is empty and has no laplacianSchemes. I did not find how to add the schemes file: keyword laplacian(k,h) is undefined in dictionary ".../system/region0SubSet/fvSchemes::laplacianSchemes" And I was also not able to set i programatically as sm.subMesh().schemesDict() ist const. How can I set my laplacian schemes for my subMesh? |
Hi Fabian
Merely make a folder called system/region0SubSet and create an fvSolution and fvScheme file in this directory. OpenFoam will automatically find these files and use them in a way identical to the basic fvSolution and fvScheme files. Kind regards, Niels |
Thanks four your reply Niels.
It does not work. When I do sm.setLargeCellSubset(sub, -1, false) instead of sm.setCellSubset(sub); the name is not changed (also commented in fvMeshSubset.C) but the directory is also empty. Do I miss something? Do I need to activate reading from the directory? |
Hi Fabian,
I went into my code to see my steps: 1. This is how I create the subMesh: Code:
// Creates a fvMeshSubset (Construction done differently in 1.6 and onwards) Code:
inline const fvMesh & cMesh() const Code:
volScalarField k Niels |
P.S. This works in 1.6-ext.
/ Niels |
I have 2.1.1, this might be the problem. The files exist, but as my dictionary is empty it might be the case that it is not read :(
I found that the vectors are only properly read when their name in their header are ok. I tried to play a little bit with the location. How can I activate debug output? I have problems debugging my code, one day it works (complete OpenFoam build in debug version) the other day it does not work with gdb :( (Linux) |
Well, if the files do exist, then what happens if you define how to compute the Laplacian? As I understand it, you have not defined the discretisation in system/region0SubSet/fvSchemes?
I have no experience with GDB, thus I cannot help you in that regard. Have a nice weekend, Niels |
Quote:
I tried also with adding region0SubSet to location or object in these files. sm.subMesh().schemesDict().size() is always empty. Any more hints? It might be something stupid, e.g. like setting the wrong entries in the location field in the files or some other file needs to be present in region0SubSet, ...? |
The submesh definetly does not try to read the scheme. I checked with strace the system calls and see all file operations.
I also cannot call dynamic_cast<fvSchemes&>(sm.subMesh()).read() as the readOpt is set to READ_ONLY and I did not find, who it can be changed. Meanwhile I'm sure this is a bug in OpenFOAM 2.1.1 This is the laplacian method in question: laplacian ( const GeometricField<GType, fvPatchField, volMesh>& gamma, const GeometricField<Type, fvPatchField, volMesh>& vf, const word& name ) { return fv::laplacianScheme<Type, GType>::New ( vf.mesh(), vf.mesh().laplacianScheme(name) )().fvmLaplacian(gamma, vf); } I add a own implementation where I can provide the laplacianScheme of the system mesh laplacian ( const GeometricField<GType, fvPatchField, volMesh>& gamma, const GeometricField<Type, fvPatchField, volMesh>& vf, const word& name, ITstream& scheme ) { return fv::laplacianScheme<Type, GType>::New ( vf.mesh(), scheme )().fvmLaplacian(gamma, vf); } |
Hi Fabian,
It is good that you found a work-around. Please report the issue in the OpenCFD's bug-tracker. Kind regards Niels |
Other solution
As fvMesh Objects are indeed construct with the NO_READ IOObject option, it do not read fvSchemes nor fvSolution dict neither for subMesh constructed from setCellSubSet() method (and looking for a system/region0SubSet as instance dir.) nor for setLargeCellSubSet(), which keeps the parent mesh system directory.
A solution, which seems to work, is to set the subMesh read option on MUST_READ manually via: Code:
subMesh.fvSchemes::readOpt() = parentMesh.fvSchemes::readOpt(); Code:
subMesh.fvSchemes::read(); Best regards, |
All times are GMT -4. The time now is 01:06. |