![]() |
adding strainRate in a solver
Hello everyone
I want to add strain rate in interFoam and I do not know how to do that. I need to define one more equation to interFoam similar to the temperature but for volume fraction and I wrote the code for solving the matrix but still have a problem with strain rate. I defined viscosity like: surfaceScalarField mu=fvc::interpolate(twoPhaseProperties.mu()); and I tried to define strain rate like: surfaceScalarField strainRate=fvc::interpolate(viscosityProperties.st rainRate()); which it seems the definition of strain rate is not correct. Do I need to declare sth in creatFields.H for it? Could anyone help me coding this part. Regards Mahyar |
Hi Mahyar,
You could always calculate the strain rate values with something like this in the top level solver: Code:
volScalarField strainRate = sqrt(2.0)*mag(symm(fvc::grad(U))); Something like this might work as well (warning:untested): Code:
surfaceScalarField strainratef = fvc::interpolate(twoPhaseProperties.nuModel1().strainRate()); Cheers, Kyle Quote:
|
HiKyle
Thanks for your reply. I tried the first part of the code that you mentioned beforein my code and I got an error about the type that strainRate returns (which is double). I was wondering should I define an object for viscosityModel class and use strainRate function through that object. I think this is the case for twophaseProperties. Best Regards Mahyar |
Hi Mahyar,
I'm confused by your statement. How can strainRate return a double if you're initializing the variable to be type volScalarField? Kyle |
Dear Kyle
sorry for the late reply. This is the exact error that I receive when I used the definition of strainRate in the code. error: call of overloaded ‘sqrt(double)’ is ambiguous regards Mahyar |
try
Code:
foam::sqrt |
Hi
I used volScalarField strainRate = foam::sqrt(2.0)*mag(symm(fvc::grad(U))); and I got this: error: ‘foam’ has not been declared Regards Mahyar |
you could always just use 1.41421356237!
|
Thanks Kyle. The solver compiled now.
|
Greetings to all!
This is one of those frequently asked questions... gotta make a note to add this to the FAQ... Mahyar, please try the following: Code:
::sqrt(2.0) Best regards, Bruno |
Hi Bruno
I checked them in my solver and the results are: scalar(sqrt(2.0)) error: call of overloaded ‘sqrt(double)’ is ambiguous, note: Foam::doubleScalar Foam::sqrt(Foam::doubleScalar) scalar(::sqrt(2.0)) It works sqrt(scalar(2.0)) error: call of overloaded ‘sqrt(double)’ is ambiguous ::sqrt(scalar(2.0)) It works ::sqrt(2.0) It works Regards Mahyar |
Hi Mahyar,
Many thanks for testing them all! I've added the working ones to the FAQ: http://openfoamwiki.net/index.php/FA...9_is_ambiguous Best regards, Bruno |
All times are GMT -4. The time now is 08:48. |