|
[Sponsors] |
Reading specific cell face area in parallel calculation of physical variables |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 12, 2024, 08:49 |
Reading specific cell face area in parallel calculation of physical variables
|
#1 |
New Member
Antonin Muesser
Join Date: Nov 2024
Posts: 1
Rep Power: 0 |
Hi everyone,
I'm currently working on a hydrological model that aims to unify Richards' equations for sub-surface infiltration flows and surface runoff. We've decided to model this runoff using a single surface mesh layer, introducing a “flag” variable that tells us whether we're in the subsurface or in the runoff layer (value of -1 in runoff, +1 in subsurface). By analogy for the different variables in the system, a single linear system must solve the runoff and subsurface equations at each iteration. The linear system can be written as follows: Code:
{ fvScalarMatrix psiEqn ( Crel*fvm::ddt(psi) == ( Krel.is_isotropic() ? fvm::laplacian(Krel.isotropic(), psi, "laplacian(Krel,psi)") : fvm::laplacian(Krel.anisotropic(), psi, "laplacian(KrelT,psi)") ) + ( Krel.is_isotropic() ? (fvc::grad(Krel.isotropic(), "grad(Krel)") & vuz) : (fvc::div((Krel.anisotropic() & vuz), "div(Krel&z)")) ) - AET ); psiEqn.solve(); } Code:
template<class HydConductivityFieldType, class VanGenuchtenFieldType, class ManningFieldType, class FlagFieldType, class IdFieldType, class KadimFieldType> tmp<HydConductivityFieldType> calc_Krel_Impl ( const HydConductivityFieldType& K, const volScalarField& psi, const volScalarField& H, const VanGenuchtenFieldType& n, const ManningFieldType& m, const volScalarField& thtil, const FlagFieldType& flag, const IdFieldType& Id, const KadimFieldType& Kadim, const fvMesh& mesh ) { return ( K * pos(flag) * // subsurface ( pos0(psi) + neg(psi) * sqrt(thtil) * sqr(1 - pow((1-pow(thtil,(n/(n - 1)))), (1 - (1/n)))) ) + neg(flag) * // run-off layer ( Kadim * // this part calculates Kxx and Kyy components in the run-off tensor. ( pos0(psi) * pow(psi, 5/3)/(m*sqrt(0.0016)) / faceArea ) + Id // ... while this part keeps the Kzz equal to 1. ) ); } I tried several implementations based on what I read online, such as Code:
point p(0.,0.,0.); //closest point to the run-off downslope cell label cellNo = mesh.findCell(p); scalar faceArea = 0.0; const cell& cFace = mesh.cells()[cellNo]; faceArea = mag(mesh.Sf()[cFace[0]]); I realize that all methods based on mesh.magSf() combined with a particular cell search don't work in parallel for this reason. By using the mesh.magSf() surface field directly in the calculations (Crel / mesh.magSf()), I'm having operator problems between the different types. I haven't found any other way around this problem without directly writing Crel = Crel / 5. in the code, because I know its precise height but I'd like to avoid having to recompile my module every time I modify the case study. By the way, the 0.0016 value corresponds to the slope at the surface and I encountered the same issue weeks ago, worked on it and gave up but I'm not willing to reproduce this and that's why I finally post this. I'm therefore open to any hint, even the obvious ones that I might have missed, as I'm more or less new to OpenFoam. Many thanks in advance. Best regards, Antonin. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Seakeeping Solver:Crashed | akbarbagusd | Fidelity CFD | 0 | November 5, 2021 13:42 |
[snappyHexMesh] Invalid Normals for source face to target face while making AMI? | Sorabh | OpenFOAM Meshing & Mesh Conversion | 1 | August 3, 2021 07:35 |
Explicitly filtered LES | saeedi | Main CFD Forum | 16 | October 14, 2015 12:58 |
[blockMesh] BlockMeshmergePatchPairs | hjasak | OpenFOAM Meshing & Mesh Conversion | 11 | August 15, 2008 08:36 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 15:00 |