snGrad at a boundary patch
I'm trying to write the normal gradient of my temperature field T at a particular boundary patch = freeSurface to a file. I tried it like:
label patchIDsurf = mesh.boundaryMesh().findPatchID("freeSurface");
and wrote the data to a file. The result is far from the value I can estimate in parafoam, not even the sign is true. I don't understand why! How doing it in the right way?
Is the sign always opposite to the one you expect, or it is mixed?
It's mixed and the ratio between the written data "gradTwritten" and the data from Paraview "gradTexpected" is gradTwritten/gradTexpected \approx -6e3.
In the meantime I thought is has maybe to do with the corresponding face area, but the face area is A = 5e-9.
Any more ideas?
Not obvious to me that you're doing anything wrong. What type of boundary condition is it, and what does your fvSchemes dictionary say about snGradSchemes? Anything unusal about your grid along that boundary?
Have you looked at wallHeatFlux.C or wallGradU.C? Looks like you already have similar logic, but the utilities calculate all of the boundaries and write them out together - maybe it would help you to look at some of the other boundaries too.
I think that it does not make any sense to calculate the surface normal gradient out of the data from a patch, because I guess that there is no data from neighbors and without neighbor cells there is no way to derive a gradient!?
Now I will try to do it like:
surfaceVectorField FvolGrad = fvc::interpolate(fvc::grad(Fvol));
vectorField FsurfGrad = FvolGrad.boundaryField()[patchID];
vectorField normal = patch().Sf()/patch().magSf();
scalarField snGradF = FsurfGrad & normal;
This works so far within a self-written BC to exclude the groovy BC and will try to implement this into my post-processing tool.
If it will not work, I'll be back!
|All times are GMT -4. The time now is 00:41.|