A computer-implemented method for performing a field operation of a field, comprising: identifying, inside a volume of interest representing a portion of the field, that a first surface segment (233-1, 332) is truncated by a second surface segment (233-2,331), wherein each of the first surface segment (233-1, 332) and the second surface segment (233-2, 331) corresponds to a geological feature (104, 106, 107) in the field; generating, based at least on a first implicit function, an extended first surface segment comprising the first surface segment (233-1, 332) and a first extension of the first surface segment (233-1, 332); generating, based at least on a second implicit function, an extended second surface segment comprising the second surface segment (233-2, 331) and a second extension of the second surface segment (233-2, 331), dividing the extended first surface segment (233-1, 332) into a valid portion and an invalid portion; dividing the volume of interest into a plurality of compartments by using at least the extended second surface segment and the extended first surface segment; merging, based on a common boundary of at least two compartments (235-1, 235-2) of the plurality of compartments being within the invalid portion of the extended first surface segment, the at least two compartments into a single merged compartment; and performing, based at least on the single merged compartment, modeling of the field to generate a modeling result; characterized in that the method further comprises: generating, using the second implicit function and for each point of the extended first surface segment, a second signed distance to the second surface segment; and associating the valid portion and the invalid portion of the extended first surface segment with opposite signs of the second signed distance, wherein the portion of the first extension including points having the same sign in the signed distance as the first surface segment (233-1, 332) is referred to as the valid portion of the first extension, and a portion of the first extension including points having the opposite sign in the signed distance than the first surface segment (233-1, 332) is referred to as the invalid portion of the first extension. identifying, inside a volume of interest representing a portion of the field, that a first surface segment (233-1, 332) is truncated by a second surface segment (233-2,331), wherein each of the first surface segment (233-1, 332) and the second surface segment (233-2, 331) corresponds to a geological feature (104, 106, 107) in the field; generating, based at least on a first implicit function, an extended first surface segment comprising the first surface segment (233-1, 332) and a first extension of the first surface segment (233-1, 332); generating, based at least on a second implicit function, an extended second surface segment comprising the second surface segment (233-2, 331) and a second extension of the second surface segment (233-2, 331), dividing the extended first surface segment (233-1, 332) into a valid portion and an invalid portion; dividing the volume of interest into a plurality of compartments by using at least the extended second surface segment and the extended first surface segment; merging, based on a common boundary of at least two compartments (235-1, 235-2) of the plurality of compartments being within the invalid portion of the extended first surface segment, the at least two compartments into a single merged compartment; and performing, based at least on the single merged compartment, modeling of the field to generate a modeling result; characterized in that the method further comprises: generating, using the second implicit function and for each point of the extended first surface segment, a second signed distance to the second surface segment; and associating the valid portion and the invalid portion of the extended first surface segment with opposite signs of the second signed distance, wherein the portion of the first extension including points having the same sign in the signed distance as the first surface segment (233-1, 332) is referred to as the valid portion of the first extension, and a portion of the first extension including points having the opposite sign in the signed distance than the first surface segment (233-1, 332) is referred to as the invalid portion of the first extension. generating, using the second implicit function and for each point of the extended first surface segment, a second signed distance to the second surface segment; and associating the valid portion and the invalid portion of the extended first surface segment with opposite signs of the second signed distance, wherein the portion of the first extension including points having the same sign in the signed distance as the first surface segment (233-1, 332) is referred to as the valid portion of the first extension, and a portion of the first extension including points having the opposite sign in the signed distance than the first surface segment (233-1, 332) is referred to as the invalid portion of the first extension.