Tobi |
April 12, 2017 17:51 |
Access to field which is evaluated at the moment
Hey everybody,
after a lot of suggestions from Philip Cardiff, I implement non-orthogonal corrections to the symmetry patches. In foam-extend it is straight forward and it is already implemented. However in FOAM-4.x it was not as straight forward than in extend or maybe I did it in an complex way. However, I build my own solidSymmetric boundary condition. Based on the fact that the class is a template one, I have to make some checks:
- Displacement field -> do non-ortho corrections
- Temperature field -> don't do non-ortho corrections (or differently)
Example given. The surface normal gradient function is given as:
Code:
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::solidSymmetryFvPatchField<Type>::snGrad() const
{
const vectorField nHat(this->patch().nf());
Field<Type> iF(this->patchInternalField());
//- Non-orthogonal correctors
if ("Displacement field")
{
vectorField delta(this->patch().delta());
vectorField k = delta - nHat * (nHat & delta);
const fvPatchTensorField& gradD =
this->patch().template lookupPatchField<volTensorField, tensor>
(
"grad(D)"
);
//- Correct iF
iF ...
}
return
(transform(I - 2.0*sqr(nHat), iF) - iF)
*(this->patch().deltaCoeffs()/2.0);
}
As you can see, I need some check if the actual field is the displacement field but I could not figure out how I can check the field name from the patch here. I went through Doxygen to figure out which class could have access to the field name (T, D, ...) but could not find anything till now. Does anyone does know how to get access which volField is calling the function at the moment?
Any feedback would be warmly welcomed and I hope I pointed out what I want to do.
|