|
[Sponsors] |
Two volScalarField created,Want to compute third volScalarField from pervious two |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 11, 2024, 01:54 |
Two volScalarField created,Want to compute third volScalarField from pervious two
|
#1 |
New Member
Waleed Khalid
Join Date: Nov 2017
Posts: 14
Rep Power: 8 |
Hi,
I have created two volScalarField, volScalarField MAXprincipalstress ( IOobject ( "MAXprincipalstress", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), (0.5 * (sigmaxx + sigmayy) + sqrt( sqr((sigmaxx- sigmayy) * 0.5 ) + sqr(sigmaxy))) ); volScalarField Minprincipalstress ( IOobject ( "Minprincipalstress", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), (0.5 * (sigmaxx + sigmayy) - sqrt( sqr((sigmaxx- sigmayy) * 0.5 ) + sqr(sigmaxy))) ); Now i want to compute third volScalarField from these two that are already created here. I am doing it like this. volScalarField EquivalentStress ( IOobject ( "EquivalentStress", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), sqrt(MAXprincipalstress(MAXprincipalstress - Minprincipalstress) * 0.5 ) ); But i am getting an error while compiling the code. Error: error: no match for call to ‘(Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}) (Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >)’ 171 | sqrt(MAXprincipalstress(MAXprincipalstress - Minprincipalstress) * 0.5 ) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~ |
|
March 11, 2024, 07:55 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,695
Rep Power: 40 |
Try using a dimensionedScalar instead of the 0.5 and see if that helps.
|
|
March 25, 2024, 09:16 |
|
#3 |
Member
Sereff
Join Date: Jan 2019
Posts: 48
Rep Power: 7 |
maybe try simply use:
sqrt((MAXprincipalstress - Minprincipalstress) * 0.5 ) instead of: sqrt(MAXprincipalstress(MAXprincipalstress - Minprincipalstress) * 0.5 ) |
|
March 26, 2024, 05:39 |
|
#4 |
New Member
Waleed Khalid
Join Date: Nov 2017
Posts: 14
Rep Power: 8 |
Thanks, it work well But why this does not work?
sqrt(MAXprincipalstress(MAXprincipalstress - Minprincipalstress) * 0.5 ) |
|
March 26, 2024, 05:43 |
|
#5 |
New Member
Waleed Khalid
Join Date: Nov 2017
Posts: 14
Rep Power: 8 |
May be Open-foam, doesn't do arithmetic operations on more than two arrays? am i right?
|
|
March 26, 2024, 05:50 |
|
#6 |
New Member
Waleed Khalid
Join Date: Nov 2017
Posts: 14
Rep Power: 8 |
Here is the final code it works well thanks Sereff
volScalarField principalstress ( IOobject ( "principalstress", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), (0.5 * (sigmaxx + sigmayy) + 0.5 * sqrt( sqr(sigmaxx- sigmayy) + 4 * sqr(sigmaxy))) ); volScalarField MAXprincipalstress ( IOobject ( "MAXprincipalstress", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), (0.5 * (sigmaxx + sigmayy) + sqrt( sqr((sigmaxx- sigmayy) * 0.5 ) + sqr(sigmaxy))) ); volScalarField Minprincipalstress ( IOobject ( "Minprincipalstress", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), (0.5 * (sigmaxx + sigmayy) - sqrt( sqr((sigmaxx- sigmayy) * 0.5 ) + sqr(sigmaxy))) ); volScalarField sigma_L ( IOobject ( "sigma_L", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), (MAXprincipalstress - Minprincipalstress) ); volScalarField EquivalentStress ( IOobject ( "EquivalentStress", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), sqrt((MAXprincipalstress * sigma_L) * 0.5 ) ); |
|
March 26, 2024, 06:36 |
|
#7 |
Member
Sereff
Join Date: Jan 2019
Posts: 48
Rep Power: 7 |
the error message
Code:
no match for call to ‘(Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}) (Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >)’ 171 | sqrt(MAXprincipalstress(MAXprincipalstress - Minprincipalstress) * 0.5 ) | Code:
MAXprincipalstress(some arguements) Code:
(MAXprincipalstress - Minprincipalstress) * 0.5 <-- some arguement Code:
Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>> |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error message | Bruno_Jorge | Main CFD Forum | 1 | February 5, 2019 11:12 |
namespace Foam | Argen | OpenFOAM | 4 | February 5, 2019 08:55 |
Adding new member function to GidaspowErgunWenYu.C of dragModel | kiang | OpenFOAM Programming & Development | 0 | June 21, 2017 05:23 |
execFlowFunctionObjects - unknown field problem | Toorop | OpenFOAM Post-Processing | 16 | March 14, 2016 03:25 |
writing execFlowFunctionObjects | immortality | OpenFOAM Post-Processing | 30 | September 15, 2013 06:16 |