|
[Sponsors] |
[Other] solids4foam developping new nonLinearGeometry mechanicalLaws looks for volScalarField |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 | |
New Member
Smail
Join Date: Jul 2022
Posts: 4
Rep Power: 4 ![]() |
Hi,
I am trying to develop new nonLinearGeomtry Mechanical law based on the class mechanicalModel/mechanicalLaws/linearGeometryLaws/linearElasticFromFile I am doing this by modifying neoHookeanElastic model so that the mechanicalProperties looks for files "mu" and "K" as volScalarField @bigphil did a similar linearGeometryLaws linearElasticFromFile. @Daniel_Khazaei did a mechanicalLaw with time-varying E timeVaryingNeoHookeanElastic. code in neoHookeanElasticFromFile.C : Quote:
Last edited by Aero_Smail; August 1, 2022 at 12:19. |
||
![]() |
![]() |
![]() |
![]() |
#2 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,091
Rep Power: 34 ![]() ![]() |
Hi Smail,
You seem to be on the right track. To make a neoHookeanElasticFromFile, I would take the following steps:
Philip |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 51 ![]() ![]() ![]() |
As Phil was already replying, I guess there is no need to give any further information. Please note: I am not very active on researchgate and hence, saw your message luckily inside my inbox
![]() Good luck and keep foaming. Thanks for your support Phil - its good to have you around here on cfd-online.com (as well as all other volunteers).
__________________
Keep foaming, Tobias Holzmann |
|
![]() |
![]() |
![]() |
![]() |
#4 | |
New Member
Smail
Join Date: Jul 2022
Posts: 4
Rep Power: 4 ![]() |
Quote:
Hi Philip, Thanks for your guidance. I appreciate it. That is exactly the procedure I am following. The new model is now successfully compiled and I am testing on few cases and will let you know if the model is fitting the needs of nonLinearGeomtryLaw functionalities. If everything goes fine I will request a commit into repository solids4foam-release. I started first by duplicating neoHookeanElastic and rename everything into new model, and commenting out other constructors contents. Just I like to highlight the errors I debugged while the conversion of the dimensionedScalar into volScalarField. By switching mu and K into volScalarField , it turns out while compiling that the member function requires some modifications in other parts of the code, such as in the constructor for example, to correctly account for these volsScalarFields. Code:
error: cannot convert ‘Foam::volScalarField’ {aka ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>’} to ‘const dimensionedScalar&’ {aka ‘const Foam::dimensioned<double>&’} 202 | if (updateFf(sigma, mu_, K_)) | ^~~ | | | Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>} Which needed to add interpolations into the constructors : Code:
muf_(fvc::interpolate(mu_)), Kf_(fvc::interpolate(K_)) As a consequence also surface field should be added to the class header should Code:
surfaceScalarField muf_; surfaceScalarField Kf_; other error in the member Functions: Code:
error: no match for ‘operator=’ (operand types are ‘Foam::surfaceSymmTensorField’ {aka ‘Foam::GeometricField<Foam::SymmTensor<double>, Foam::fvsPatchField, Foam::surfaceMesh>’} and ‘Foam::tmp<Foam::Field<Foam::SymmTensor<double> > >’) 219 | sigma = (1.0/J)*(0.5*K_*(pow(J, 2) - 1)*I + s); | ^ I commented out linearised elasticity NOT to allowing solver enforceLinear switch. Would you have any other comments feel free to let me know here. |
||
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
Smail
Join Date: Jul 2022
Posts: 4
Rep Power: 4 ![]() |
Additional changes required in mechanicalLaw to overcome the error:
Code:
error: cannot convert ‘Foam::volScalarField’ {aka ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>’} to ‘const dimensionedScalar&’ {aka ‘const Foam::dimensioned<double>&’} 202 | if (updateFf(sigma, mu_, K_)) | ^~~ | | | Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>} It turned out that the current mechanicalLaw needs other changes in order to allow conversion of mu and K into volScalarField. since the two quantities are defined in the mechanicalLaw.H as: Code:
bool updateF ( volSymmTensorField& sigma, const dimensionedScalar& mu, const dimensionedScalar& K ); //- Equivalent to the updateF function, except instead for the Ff // surface field bool updateFf ( surfaceSymmTensorField& sigma, const dimensionedScalar& mu, const dimensionedScalar& K I am saying that since there is a definition of the mu and K in the original mechanicalLaw as dimensionedScalar and I need to convert that to volScalarField. In other word, Do I need to compile another newMechanicalLaw classe to supply to the my model. Last edited by Aero_Smail; August 11, 2022 at 16:18. |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Super Moderator
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,091
Rep Power: 34 ![]() ![]() |
Hi Aero_Smail,
In this case, the easiest thing is to re-write the "updateF" function directly in your new neoHookeanElasticFromFile class correct function, e.g. Code:
void Foam::neoHookeanElasticFromFile::correct(volSymmTensorField& sigma) { // We need to call the updateF procedures manually as mu and K are fields // if (updateF(sigma, mu_, K_)) // { // return; // } // Copied and modified from mechanicalLaw::updateF(...) where I have removed the enforceLinear stuff // Check if the mathematical model is in total or updated Lagrangian form if (nonLinGeom() == nonLinearGeometry::UPDATED_LAGRANGIAN) { if (!incremental()) { FatalErrorIn(type() + "::correct(volSymmTensorField& sigma)") << "Not implemented for non-incremental updated Lagrangian" << abort(FatalError); } // Lookup gradient of displacement increment const volTensorField& gradDD = mesh().lookupObject<volTensorField>("grad(DD)"); // Calculate the relative deformation gradient relF() = I + gradDD.T(); // Update the total deformation gradient F() = relF() & F().oldTime(); } else if (nonLinGeom() == nonLinearGeometry::TOTAL_LAGRANGIAN) { if (incremental()) { // Lookup gradient of displacement increment const volTensorField& gradDD = mesh().lookupObject<volTensorField>("grad(DD)"); // Update the total deformation gradient // Note: grad is wrt reference configuration F() = F().oldTime() + gradDD.T(); // Update the relative deformation gradient: not needed relF() = F() & inv(F().oldTime()); } else { // Lookup gradient of displacement const volTensorField& gradD = mesh().lookupObject<volTensorField>("grad(D)"); // Update the total deformation gradient F() = I + gradD.T(); // Update the relative deformation gradient: not needed relF() = F() & inv(F().oldTime()); } } else { FatalErrorIn ( "void " + type() + "::correct(volSymmTensorField& sigma)" ) << "Unknown nonLinGeom type: " << nonLinGeom() << abort(FatalError); } // ... rest of your correct function } |
|
![]() |
![]() |
![]() |
![]() |
#7 |
New Member
Smail
Join Date: Jul 2022
Posts: 4
Rep Power: 4 ![]() |
Dear Big Philip
That's very helpful to overcome this situation. Thank you for your guidance. It is successfully compiled and the new library should be called in the controlDict. I did add the updateF function into the new model and I did similarly to the other field function updateFf . This is updating the sigma and I am testing on some cases to check the calculations are rational and let you know as soon as. Thanks a lot Big Philip. |
|
![]() |
![]() |
![]() |
Tags |
mechanicallaws, nonlineargeometry, solids4foam |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
solids4Foam & FOAM-FSI | farah.elias | OpenFOAM | 21 | August 28, 2023 15:57 |
solids4Foam installation, foam-extend 4.0, ubuntu 18.04 | baezacaljo | OpenFOAM | 0 | July 17, 2021 00:35 |