Create .bch in MacOs for definition y assignation of materials

I have tried various methods to define and assign materials for the Kratos problem via a .bch file, running GiD in -n or -n2 mode.

GiD 18 freezes when I attempt to define the problem type, select the application, and specify the dimensions (2D or 3D). It seems that the selection windows remain active, preventing GiD from continuing its operation.

Could you please advise on how to resolve this issue? Additionally, what is the recommended method for defining and assigning materials, boundary conditions, and loads using a .bch file while running GiD in a headless (windowless) mode?

thanks

Alvaro

The answer depends on the Kratos application that you are using,

because each application decides how to store (name, parent, type,…) its own data in the customLib xml tree
and each problemtype can define its own Tcl procs that can facilitate the access of these data.

In any case, to access to the customLib xml tree is necessary to use some Tcl code

and in a .bch file is possible to call Tcl code with the syntax

*****TCL and_the_tcl_code
You can have a look to the ‘examples’ provided in kratos, like (Fluid 2D)

“\problemtypes\kratos.gid\apps\Fluid\examples\CylinderInFlow.tcl”
these examples usually create a simple geometry, and define its material properties and boundary conditions
the Tcl code is something like this

set dom_item [spdAux::getRoute “FLParts”]

set fluidNode [customlib::AddConditionGroupOnXPath $dom_item MyPart]

set props [list Element Monolithic$nd ConstitutiveLaw Newtonian2DLaw DENSITY 1.0 DYNAMIC_VISCOSITY 0.002]

spdAux::SetValuesOnBaseNode $dom_item $props

This code assume that exists a GiD group named MyPart, and add to the tree a Part linked with this group, and set the material fields with some values

and from the bath can call each line with *****TCL or better create a proc with multiple commands and do a single *****TCL call to this proc

“Thank you very much for such a clear response. I’ll start implementing your recommendations right away.”