Change Boundary Condition Type From Solver
Hi guys:). I want to change boundary condition type within the solver. how can I do it. for example initially Pressure boundary condition on a patch is fixedFluxPressure and I want when I reach certain time during simulation, change it to fixed value with specified value. (I want to do this from solver)
boundaryField { Left { type fixedFluxPressure; } . .// other BCs . } then change it to : boundaryField { Left { type fixedValue; value 1e5; } . .// other BCs . } |
I found it!
finally i found it and i leave this reply to my post maybe help another one with this issue some days later.
to change boundary condition type for a field, first you must find patch id of that face. label leftFacePatchID = mesh.boundaryMesh().findPatchID("Left"); const polyPatch& leftPatch = mesh.boundaryMesh()[leftFacePatchID]; then you can set boundary type with this syntax: (for example if pressure is desired field with p notation) p.boundaryFieldRef().set(leftFacePatchID , fvPatchField<scalar>::New("fixedValue", mesh.boundary()[leftFacePatchID ],p)); in above, first argument of New() must be boundary type, and for example here it sets BC to fixedValue. then to assign a value to this fixed value BC, we must go through all cells face in patch and set desired value. forAll(leftPatch , faceI) { p.boundaryFieldRef()[leftFacePatchID][faceI] = pressureValue; } |
All times are GMT -4. The time now is 03:22. |