-
Notifications
You must be signed in to change notification settings - Fork 1
Creating a new example
Danilo Cavalcanti edited this page Jun 5, 2025
·
14 revisions
The PorousLab framework is designed for object-oriented simulation of porous media problems. A simulation follows a well-defined workflow involving two main objects:
-
mdl: the model object (geometry, materials, boundary conditions) -
anl: the analysis object (solver settings, execution)
Algorithm: Setting up an example in PorousLab
1. Create and configure the model object (mdl):
a. Instantiate the appropriate model class
(e.g., Model_H, Model_M, Model_HM)
b. Load or generate mesh data: node, elem
c. Set the mesh using: mdl.setMesh(node, elem)
d. Define and configure material objects
(e.g., PorousMedia, Fluid)
e. Assign materials to the model: mdl.setMaterial(...)
f. Apply boundary and initial conditions
2. Create and configure the analysis object (anl):
a. Instantiate analysis class
(e.g., Anl_Linear, Anl_Transient)
b. Set solver parameters (e.g., time step, tolerances)
3. Run the simulation:
anl.run(mdl)
4. Post-process the results:
Use built-in tools such as:
- mdl.plotField('variable')
- mdl.plotFieldAlongSegment(...)
- mdl.plotDeformedMesh(...)
PorousLab uses:
-
NODE: an[nNodes x 2]matrix with node coordinates -
ELEM: a{nElem x 1}cell array with element connectivity
Meshes can be:
- Generated internally with
regularMesh(...) - Imported from external tools such as Gmsh using this converter
Assign mesh to the model with:
mdl.setMesh(node, elem);You can apply Dirichlet and Neumann BCs in three ways:
-
At node:
setDirichletBCAtNode,setNeumannBCAtNode -
At point:
setDirichletBCAtPoint,setNeumannBCAtPoint -
At border:
setDirichletBCAtBorder('left'), etc.
Physics-specific methods like:
setPressureDirichletBCAtNodesetDisplacementDirichletBCAtBorder
Visualization is done through FEMPlot methods:
-
plotField('pressure'): scalar field contour -
plotFieldAlongSegment(p1, p2, 'pressure'): profile plot -
plotDeformedMesh(scale): view deformed configuration (mechanics)
Textual outputs:
-
printResults(): print nodal results -
printResultsHeader(): customize variable labels