# Assigning loads to surfaces / automated boundary conditions

**URL:** <https://calculix.discourse.group/t/assigning-loads-to-surfaces-automated-boundary-conditions/601>\
**Category:** Uncategorized\
**Created:** [June 4, 2021, 2:41pm UTC](https://calculix.discourse.group/t/assigning-loads-to-surfaces-automated-boundary-conditions/601 "2021-06-04T14:41:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luna](https://avatars.discourse-cdn.com/v4/letter/l/9fc348/32.png) [@Luna](https://calculix.discourse.group/u/Luna)\
**Post date:** [June 4, 2021, 2:41pm UTC](https://calculix.discourse.group/t/assigning-loads-to-surfaces-automated-boundary-conditions/601/1 "2021-06-04T14:41:27Z")

</div>

Dear all,

I am building a hex mesh with cgx and I want to automate the meshing process for mesh refinement studies. I already wrote a parametrized fbd script for mesh generation, but I still have to assign the boundary conditions manually using `qadd` in the cgx gui after meshing. I am looking for a **zero-click-approach** , so-to-say.

1. Is there a way to **assign loads to surfaces** rather than element faces? (gmsh-style)

or, alternitavely,

1. Can I **automatically assign boundary conditions** , maybe by mapping them from a file with the same geometry but a different mesh?

I already found that the `enq` command makes it possitble to select specific elements after meshing, but this only seems to work well for simple geometries.  
I also see the option of creating different sets using `seta` after meshing…  
Just before I do that, I just want to make sure there is no easier way that I overlooked.

I appreciate any hints.

---

<div class="post-metadata">

**Author:** ![SergioP](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/sergiop/32/10_2.png) [@SergioP](https://calculix.discourse.group/u/SergioP)\
**Post date:** [June 4, 2021, 4:57pm UTC](https://calculix.discourse.group/t/assigning-loads-to-surfaces-automated-boundary-conditions/601/2 "2021-06-04T16:57:07Z")

</div>

The number 2 could be done by means of \*SUBMODEL card, check in the CCX documentation.

---

<div class="post-metadata">

**Author:** ![Luna](https://avatars.discourse-cdn.com/v4/letter/l/9fc348/32.png) [@Luna](https://calculix.discourse.group/u/Luna)\
**Post date:** [June 4, 2021, 5:56pm UTC](https://calculix.discourse.group/t/assigning-loads-to-surfaces-automated-boundary-conditions/601/3 "2021-06-04T17:56:55Z")

</div>

Thanks, I will look into that!

---

<div class="post-metadata">

**Author:** ![mkraska](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@mkraska](https://calculix.discourse.group/u/mkraska)\
**Post date:** [June 7, 2021, 11:09am UTC](https://calculix.discourse.group/t/assigning-loads-to-surfaces-automated-boundary-conditions/601/4 "2021-06-07T11:09:36Z")

</div>

CGX has a lot of options to perform the task. Im my example collection at github these are used in nearly all cases.

**Topology-based selection:** If you have a surface A00F in CGX, then the following code writes aa ccx surface definition (set of element faces) to a file

```auto
seta load s A00F  
comp load do
comp load do
send load abq sur

```

Then include the file load.sur in your ccx input deck and use it for contact or pressure application

**Location-based selection:** As you already mentionded, another way is to create location-based sets of nodes with command “enq” and expand (“complete”) them to element face sets using “comp” as above.

---

<div class="post-metadata">

**Author:** ![Luna](https://avatars.discourse-cdn.com/v4/letter/l/9fc348/32.png) [@Luna](https://calculix.discourse.group/u/Luna)\
**Post date:** [June 9, 2021, 2:09pm UTC](https://calculix.discourse.group/t/assigning-loads-to-surfaces-automated-boundary-conditions/601/5 "2021-06-09T14:09:47Z")

</div>

Thanks a lot, the topology-based selection is exactly what I was looking for!
